System module for sleeping, restarting, and shutting down the system on Mac OS X
New in version 2016.3.0.
Warning
Using this module will enable atrun
on the system if it is disabled.
Get the kernel architecture setting from com.apple.Boot.plist
A string value representing the boot architecture setting
CLI Example:
salt '*' system.get_boot_arch
Gets the computer name
The computer name
CLI Example:
salt '*' system.get_computer_name
Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged.
True if disable keyboard on lock is on, False if off
CLI Example:
salt '*' system.get_disable_keyboard_on_lock
Displays whether remote apple events are on or off.
True if remote apple events are on, False if off
CLI Example:
salt '*' system.get_remote_events
Displays whether remote login (SSH) is on or off.
True if remote login is on, False if off
CLI Example:
salt '*' system.get_remote_login
Get the number of seconds after which the computer will start up after a power failure.
A string value representing the number of seconds the system will delay restart after power loss
CLI Example:
salt '*' system.get_restart_delay
Displays the current startup disk
The current startup disk
CLI Example:
salt '*' system.get_startup_disk
Gets the local subnet name
The local subnet name
CLI Example:
salt '*' system.get_subnet_name
Halt a running system
at_time (str) --
Any valid at expression. For example, some valid at expressions could be:
noon
midnight
fri
9:00 AM
2:30 PM tomorrow
now + 10 minutes
Note
If you pass a time only, with no 'AM/PM' designation, you have to double quote the parameter on the command line. For example: '"14:00"'
CLI Example:
salt '*' system.halt
salt '*' system.halt 'now + 10 minutes'
List all valid startup disks on the system.
A list of valid startup disks
CLI Example:
salt '*' system.list_startup_disks
Restart the system
at_time (str) --
Any valid at expression. For example, some valid at expressions could be:
noon
midnight
fri
9:00 AM
2:30 PM tomorrow
now + 10 minutes
Note
If you pass a time only, with no 'AM/PM' designation, you have to double quote the parameter on the command line. For example: '"14:00"'
CLI Example:
salt '*' system.restart
salt '*' system.restart '12:00 PM fri'
Set the kernel to boot in 32 or 64 bit mode on next boot.
Note
When this function fails with the error changes to kernel
architecture failed to save!
, then the boot arch is not updated.
This is either an Apple bug, not available on the test system, or a
result of system files being locked down in macOS (SIP Protection).
arch (str) --
A string representing the desired architecture. If no value is passed, default is assumed. Valid values include:
i386
x86_64
default
True if successful, False if not
CLI Example:
salt '*' system.set_boot_arch i386
Set the computer name
name (str) -- The new computer name
True if successful, False if not
CLI Example:
salt '*' system.set_computer_name "Mike's Mac"
Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged.
enable (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' system.set_disable_keyboard_on_lock False
Set whether the server responds to events sent by other computers (such as AppleScripts)
enable (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' system.set_remote_events On
Set the remote login (SSH) to either on or off.
enable (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' system.set_remote_login True
Set the number of seconds after which the computer will start up after a power failure.
Warning
This command fails with the following error:
Error, IOServiceOpen returned 0x10000003
The setting is not updated. This is an apple bug. It seems like it may only work on certain versions of Mac Server X. This article explains the issue in more detail, though it is quite old.
http://lists.apple.com/archives/macos-x-server/2006/Jul/msg00967.html
seconds (int) -- The number of seconds. Must be a multiple of 30
True if successful, False if not
CLI Example:
salt '*' system.set_restart_delay 180
Set the current startup disk to the indicated path. Use
system.list_startup_disks
to find valid startup disks on the system.
path (str) -- The valid startup disk path
True if successful, False if not
CLI Example:
salt '*' system.set_startup_disk /System/Library/CoreServices
Set the local subnet name
name (str) -- The new local subnet name
Note
Spaces are changed to dashes. Other special characters are removed.
True if successful, False if not
CLI Example:
The following will be set as 'Mikes-Mac'
salt '*' system.set_subnet_name "Mike's Mac"
Shutdown the system
at_time (str) --
Any valid at expression. For example, some valid at expressions could be:
noon
midnight
fri
9:00 AM
2:30 PM tomorrow
now + 10 minutes
Note
If you pass a time only, with no 'AM/PM' designation, you have to double quote the parameter on the command line. For example: '"14:00"'
CLI Example:
salt '*' system.shutdown
salt '*' system.shutdown 'now + 1 hour'
Sleep the system. If a user is active on the system it will likely fail to sleep.
at_time (str) --
Any valid at expression. For example, some valid at expressions could be:
noon
midnight
fri
9:00 AM
2:30 PM tomorrow
now + 10 minutes
Note
If you pass a time only, with no 'AM/PM' designation, you have to double quote the parameter on the command line. For example: '"14:00"'
CLI Example:
salt '*' system.sleep
salt '*' system.sleep '10:00 PM'