salt.modules.service

The default service module, if not otherwise specified salt will fall back to this basic module

salt.modules.service.available(name)

Returns True if the specified service is available, otherwise returns False.

CLI 范例:

salt '*' service.available sshd
salt.modules.service.get_all()

Return a list of all available services

CLI 范例:

salt '*' service.get_all
salt.modules.service.missing(name)

The inverse of service.available. Returns True if the specified service is not available, otherwise returns False.

CLI 范例:

salt '*' service.missing sshd
salt.modules.service.reload(name)

Refreshes config files by calling service reload. Does not perform a full restart.

CLI 范例:

salt '*' service.reload <service name>
salt.modules.service.restart(name)

Restart the specified service

CLI 范例:

salt '*' service.restart <service name>
salt.modules.service.run(name, action)

Run the specified service with an action.

2015.8.1 新版功能.

name
Service name.
action
Action name (like start, stop, reload, restart).

CLI 范例:

salt '*' service.run apache2 reload
salt '*' service.run postgresql initdb
salt.modules.service.start(name)

Start the specified service

CLI 范例:

salt '*' service.start <service name>
salt.modules.service.status(name, sig=None)

Return the status for a service, returns the PID or an empty string if the service is running or not, pass a signature to use to find the service via ps

CLI 范例:

salt '*' service.status <service name> [service signature]
salt.modules.service.stop(name)

Stop the specified service

CLI 范例:

salt '*' service.stop <service name>