salt.modules.launchctl_service

Module for the management of MacOS systems that use launchd/launchctl

Important

If you feel that Salt should be using this module to manage services on a minion, and it is using a different module (or gives an error similar to 'service.start' is not available), see here.

depends:
  • plistlib Python module

salt.modules.launchctl_service.available(job_label)

Check that the given service is available.

CLI Example:

salt '*' service.available com.openssh.sshd
salt.modules.launchctl_service.disabled(job_label, runas=None)

Return True if the named service is disabled, false otherwise

CLI Example:

salt '*' service.disabled <service label>
salt.modules.launchctl_service.enabled(job_label, runas=None)

Return True if the named service is enabled, false otherwise

CLI Example:

salt '*' service.enabled <service label>
salt.modules.launchctl_service.get_all()

Return all installed services

CLI Example:

salt '*' service.get_all
salt.modules.launchctl_service.missing(job_label)

The inverse of service.available Check that the given service is not available.

CLI Example:

salt '*' service.missing com.openssh.sshd
salt.modules.launchctl_service.restart(job_label, runas=None)

Restart the named service

CLI Example:

salt '*' service.restart <service label>
salt.modules.launchctl_service.start(job_label, runas=None)

Start the specified service

CLI Example:

salt '*' service.start <service label>
salt '*' service.start org.ntp.ntpd
salt '*' service.start /System/Library/LaunchDaemons/org.ntp.ntpd.plist
salt.modules.launchctl_service.status(name, runas=None)

Return the status for a service via systemd. If the name contains globbing, a dict mapping service name to True/False values is returned.

Changed in version 2018.3.0: The service name can now be a glob (e.g. salt*)

Parameters:
  • name (str) -- The name of the service to check

  • runas (str) -- User to run launchctl commands

Returns:

True if running, False otherwise dict: Maps service name to True if running, False otherwise

Return type:

bool

CLI Example:

salt '*' service.status <service name>
salt.modules.launchctl_service.stop(job_label, runas=None)

Stop the specified service

CLI Example:

salt '*' service.stop <service label>
salt '*' service.stop org.ntp.ntpd
salt '*' service.stop /System/Library/LaunchDaemons/org.ntp.ntpd.plist