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
Returns: | A string value representing the boot architecture setting |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_boot_arch
Gets the computer name
Returns: | The computer name |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_computer_name
Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged.
Returns: | True if disable keyboard on lock is on, False if off |
---|---|
Return type: | bool |
CLI Example:
..code-block:: bash
salt '*' system.get_disable_keyboard_on_lock
Displays whether remote apple events are on or off.
Returns: | True if remote apple events are on, False if off |
---|---|
Return type: | bool |
CLI Example:
salt '*' system.get_remote_events
Displays whether remote login (SSH) is on or off.
Returns: | True if remote login is on, False if off |
---|---|
Return type: | bool |
CLI Example:
salt '*' system.get_remote_login
Get the number of seconds after which the computer will start up after a power failure.
Returns: | A string value representing the number of seconds the system will delay restart after power loss |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_restart_delay
Displays the current startup disk
Returns: | The current startup disk |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_startup_disk
Gets the local subnet name
Returns: | The local subnet name |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_subnet_name
Halt a running system
Parameters: |
at_time (str) -- Any valid at expression. For example, some valid at expressions could be:
|
---|
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.
Returns: | A list of valid startup disks |
---|---|
Return type: | list |
CLI Example:
salt '*' system.list_startup_disks
Restart the system
Parameters: |
at_time (str) -- Any valid at expression. For example, some valid at expressions could be:
|
---|
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).
Parameters: |
arch (str) -- A string representing the desired architecture. If no value is passed, default is assumed. Valid values include:
|
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
CLI Example:
salt '*' system.set_boot_arch i386
Set the computer name
Parameters: | name (str) -- The new computer name |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
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.
Parameters: | 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 |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
CLI Example:
salt '*' system.set_disable_keyboard_on_lock False
Set whether the server responds to events sent by other computers (such as AppleScripts)
Parameters: | 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 |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
CLI Example:
salt '*' system.set_remote_events On
Set the remote login (SSH) to either on or off.
Parameters: | 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 |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
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
Parameters: | seconds (int) -- The number of seconds. Must be a multiple of 30 |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
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.
Parameters: | path (str) -- The valid startup disk path |
---|---|
Returns: | True if successful, False if not |
Return type: | bool |
CLI Example:
salt '*' system.set_startup_disk /System/Library/CoreServices
Set the local subnet name
Parameters: | name (str) -- The new local subnet name |
---|
Note
Spaces are changed to dashes. Other special characters are removed.
Returns: | True if successful, False if not |
---|---|
Return type: | bool |
CLI Example:
The following will be set as 'Mikes-Mac' salt '*' system.set_subnet_name "Mike's Mac"
Shutdown the system
Parameters: |
at_time (str) -- Any valid at expression. For example, some valid at expressions could be:
|
---|
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.
Parameters: |
at_time (str) -- Any valid at expression. For example, some valid at expressions could be:
|
---|
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'
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.mac_system.html