Skip to main content

NightWatchman Enterprise 7.3

1E Agent Mac command-line switches
Introduction

The 1E Agent Mac provides Nightwatchman functionality on Apple Mac devices.

For details of how to install the 1E Agent Mac, please refer to Installing the Mac 1E Agent page.

Mac command-line syntax

You can use the NightWatchman command line tool to configure general parameters, to initiate an immediate shutdown, standby or hibernate; or to configure a "once-off" shutdown, standby or hibernate.

The syntax depends on whether you are configuring settings, or issuing commands.

Use ./nightwatchman -help to see about all the switches available.

All switches must be preceded by a -s followed by the name of the switch and its value, separated by spaces:

sudo ./nightwatchman -s < switch > <value>

For example, to set NightWatchman countdown seconds to 120:

sudo ./nightwatchman -s countdownsecs 120

Commands consist of the switch preceded by a dash. For example,to put a Mac into sleep mode:

sudo ./nightwatchman -standbynow

Specific switches that set parameters not contained in the settings file have the same syntax as commands but are followed a space and their values. For example, to set an alarm clock for Monday and Tuesday at 6am and 7am respectively:

sudo ./nightwatchman -alarmclock mon= 06 : 00 , tue= 07 : 00

Switches that set parameters using the this format are:

All other switches that set values use the -s format.

Use a space to separate switches in a command-line if you're using more than one switch. For example, to set a countdown time to 120 seconds, display "Time to sleep" in the countdown dialog and put the Mac into sleep mode:

sudo ./nightwatchman -standbynow -s countdownsecs 120 -s countdowndlgtext "Time to sleep"

Mac command reference
Miscellaneous commands

-g

Displays the current NightWatchman settings.

-s <SETTINGNAME> <SETTINGVALUE>

Sets the named setting to the specified value.

-version

Displays the installed version of NightWatchman.

Logging

-debug N

Sets the level of debug information output to the NightWatchman log files. The default value is 0.

The supported values are:

0 = "critical" logging, which means only essential messages are logged, such as errors, failures and a few important informational messages.

1 = "debug" logging, which logs messages regarding the steps taken, and settings used, by the software.

2 = "maximum" logging, which logs all messages, including some that occur too frequently to be useful in normal situations.

Action/Once-Off Commands

-shutdownnow

Schedules an immediate shutdown. The command accepts the optional parameters LogOffAction, CountdownSecs and CountdownDlgText.

-rebootnow

Schedules an immediate reboot (restart). The command accepts the optional parameters LogOffAction, CountdownSecs and CountdownDlgText.

-hibernatenow

Schedules an immediate hibernate (suspend). The command accepts the optional parameters CountdownSecs and CountdownDlgText.

-standbynow

Schedules an immediate standby (sleep). The command accepts the optional parameters CountdownSecs and CountdownDlgText.

-onceoff

Sets parameters for a "once-off" shutdown, log-off, hibernate, standby, etc.

The command requires the ShutdownTime parameter, and accepts the optional parameters ShutdownDate, ShutdownAction, LogOffAction, CountdownSecs and CountdownDlgText.

General Settings

-s CountdownSecs NN

Sets the number of seconds that the countdown timer dialog box will be displayed before the shutdown or log-off action is executed.

The minimum value is 0 seconds. The maximum value is 3600 seconds (1 hour).

-s LogOffAction Passive|Active|Force

Determines the behavior when a user is logged onto the system.

Can be set to one of Passive, Active or Force.

-s RetryAttempts NN

Sets the number of times that a power down will be attempted if cancelled by the user. The minimum value is 0 retries. The maximum value is 1440 retries. The default value is 3 retries.

-s RetryInterval MINS

Sets the interval (in minutes) at which the service will retry a power down if cancelled by the user or if a power down cannot be performed. The minimum value is 1 minute. The maximum value is 60 minutes. The default value is 60 minutes.

-s ShutdownAction Hibernate|Logoff|Normal|PowerOff|Reboot|Standby

Determines the power down method. Can be set to one of Hibernate, Logoff, Normal, PowerOff, Reboot or Standby.

-s CountdownDlgText MESSAGE

Customize the NightWatchman power down message. For example:

NightWatchman -s CountdownDlgText "Shutting down for scheduled maintenance"

Script Behavior Settings

-s IgnoreScriptErrors ON|OFF

Sets the behavior on encountering errors in the power down scripts.

When set to OFF (the default), any errors in the power down scripts will prevent the power down from taking place.

When set to ON, any errors in the power down scripts will be ignored and the power down will be allowed to continue.

-s RunAlways ON|OFF

When set to ON, every power down action (except for sleep and hibernate) will run the RunAlways scripts after any other scripts have run.

-s RunAlwaysOnSleep ON|OFF

When set to ON, every sleep or hibernate power down action will run the RunAlwaysOnSleep scripts after any other scripts have any run.

-s RunAlwaysOnResume ON|OFF

When set to ON, the RunAlwaysOnResume scripts will be run after the system wakes up from a sleep or hibernate power down action.

-s RunAlwaysOnResumeDelaySecs SECS

Controls the number of seconds that NightWatchman will wait before starting the RunAlwaysOnResume scripts. The minimum value is 0. The maximum value is 300 (5 minutes). The default value is 30 seconds

-s ScriptTimeoutSecs SECS

Controls how many seconds NightWatchman will wait before it decides that a script has timed out. The minimum value is 1. The maximum value is 120 (2 minutes). The default value is 10 seconds.

Power Profile Settings

-s PowerScheme ON|OFF

Controls whether NightWatchman will attempt to enforce a power scheme. Can be set to one of the following values:

ON: The NightWatchman power scheme will be applied when the service starts and when a user logs in.

OFF: The power scheme will not be applied. (Default)

-s DiskAC MINS

Set the hard disks to switch to standby after a specified number of minutes of system idle time when the computer is running on mains power. A value of zero turns this power management option off. The default value is 10.

-s DiskDC MINS

Set the hard disks to switch to standby after a specified number of minutes of system idle time when the computer is running on battery power. A value of zero turns this power management option off. The default value is 10.

-s HibernateAC MINS

Set the computer to hibernate after a specified number of minutes of system idle time when the computer is running on mains power. A value of zero turns this power management option off. The default value is 0.

-s HibernateDC MINS

Set the computer to hibernate after a specified number of minutes of system idle time when the computer is running on battery power. A value of zero turns this power management option off. The default value is 10.

-s MonitorAC MINS

Set the monitor to switch to standby after a specified number of minutes of system idle time when the computer is running on mains power. A value of zero turns this power management option off. The default value is 10.

-s MonitorDC MINS

Set the monitor to switch to standby after a specified number of minutes of system idle time when the computer is running on battery power. A value of zero turns this power management option off. The default value is 2.

-s StandbyAC MINS

Set the computer to switch to standby after a specified number of minutes of system idle time when the computer is running on mains power. A value of zero turns this power management option off. The default value is 10.

-s StandbyDC MINS

Set the computer to switch to standby after a specified number of minutes of system idle time when the computer is running on battery power. A value of zero turns this power management option off. The default value is 10.

-s PasswordOnWakeup ON|OFF

Sets whether a password logon is required when the system resumes from standby or hibernate.

Example:

NightWatchman -s DiskAC 60 DiskDC 5 HibernateAC 0 HibernateDC 0 MonitorAC 15 MonitorDC 3 StandbyAC 60 StandbyDC 5

Changes the values of the NightWatchman power scheme. Values are given in minutes.

Reporting Settings

-s Reporting ON|OFF

Turns NightWatchman reporting on or off.

-s MaxBatchSendIntervalSecs SECS

Sets the maximum interval to wait before batch dispatching messages in the spooler to the reporting server.

-s MaximumFileAgeSecs SECS

Sets the maximum age of a reporting file. Beyond this value, the file will not be submitted to the reporting server and will instead be deleted.

-s MinMessagesPerBatch NN

Sets the minimum number of messages in the spooler before a batch is dispatched to the reporting server.

-s PollIntervalSecs SECS

Sets the number of seconds to wait before the spooler will check for new reporting messages.

-s MacSpoolerDirectory DIRECTORYPATH

Sets the location to which reporting messages are spooled before being sent to the reporting server.

-s WaitMinutesForUnavailableServer MINS

Sets the number of minutes to wait before the spooler will retry connecting to the reporting server.

Alarm Clock Command

-alarmclock sun=23:59,mon=23:59,wed=23:59,sat=23:59

Sets up an alarm clock schedule for any day of the week that will allow the machine to be woken up at the specified time.

Maintenance Window Command

-maintenancewnd sun=23:59,23,0 mon=11:00,25,1

Sets up a maintenance window schedule for any day of the week to prevent the machine from being shut down by NightWatchman during that period.

Scheduled Actions Command

-scheduledactions DAY{,DAY,DAY,..,}=TIME,SHUTDOWNACTION,LOGOFFACTION {..,}

Sets up a schedule action for any day of the week to schedule a powerdown event in the machine by NightWatchman during that period.

DAY can be one of the weekday from {sun, mon, tue, wed, thu, fri, sat} or ALLDAYS which indicates all days in week, WEEKDAYS indicating (mon-fri) and WEEKEND indicating (sat, sun)

TIME has to be hh:mm format

SHUTDOWNACTION can be set to one of { PowerOff, Normal, Logoff, Standby, Hibernate, Reboot }

LOGOFFACTION can be set to one of { Passive, Active, Force }

Example:

-scheduledactions fri,sat=15:37,standby,passive mon,weekdays=22:00,reboot,force weekend=12:00,logoff,active

Process Exception List Commands

-pelistfrom FILEPATH

Clears and adds a list of process names into the process exception list from a file.

-pelistclear

Clears the process exception list.

-pelistadd PROCESSNAME

Adds the name of a single process to the process exception list.

-pelistdel PROCESSNAME

Removes the name of a single process from the process exception list.

-pelistshow

Displays the process exception list.

Power Policy Settings

-s PollIntervalMins MINS

Sets the polling interval to check for new power policy check in minutes. This is a number between 1 and 43200.

-s PollRetryIntervalMins MINS

Sets the initial retry interval to check for new power after failure. policy check in minutes. This is a number between 1 and 1440.

Server Settings

-s HTTPServer server

Specifies the domain name or address of the HTTP server used for reporting and policy retrieval. This value can be suffixed with a custom port number. eg. server:80

-s HTTPSServer server

Specifies the domain name or address of the secure HTTPS server used for reporting and policy retrieval. This value can be suffixed with a custom port number. eg. server:443

Miscellaneous Settings

-s PreRun true|false

Enables the running of a custom script prior to Nightwatchman commencing the power down process.

-s SystemTray OFF|ON|ON1

Controls the display of the status menu icon. The default value is ON.

The ON1 setting enables the status menu icon, but disables the "Keep Active" menu item.

-s UserActivityMaxIdleMins MINS

Controls the length of the window (in minutes) within which a user must have been active if the power down is to be automatically postponed (ie. will not show a power down message but automatically postpone the power down).

This setting does not affect power downs started from the status menu or those with LogOffAction Force. The minimum value is 0. The maximum value is 1440 (24 hours). The default value is 0, which disables the feature.