service

Service management for Alpine Linux via OpenRC.

This module registers under Salt’s service virtual name and is loaded automatically on Alpine minions. Existing states such as service.running and service.dead work without any changes to your state files.

Important

If Salt is not using this module on an Alpine minion (or you see an error such as ‘service.start’ is not available), see here.

Runlevels

OpenRC organises services into named runlevels rather than systemd targets. The two runlevels relevant to most service management work are:

default

Services that should start when the system reaches a normal running state. This is the runlevel used by enable() and disable() when no runlevel argument is supplied.

boot

Services that must start earlier in the boot sequence, such as networking, syslog, and hostname. To manage a service in this runlevel, pass runlevel=boot explicitly.

Other runlevels (sysinit, shutdown, nonetwork) exist but are rarely targeted directly by Salt states.

saltext.alpine.modules.openrc.__virtual__()[source]

Only load on Alpine Linux systems with OpenRC present.

saltext.alpine.modules.openrc.start(name, **_)[source]

Start the named service.

CLI Example:

salt '*' service.start <service name>
saltext.alpine.modules.openrc.stop(name, **_)[source]

Stop the named service.

CLI Example:

salt '*' service.stop <service name>
saltext.alpine.modules.openrc.restart(name, **_)[source]

Restart the named service.

CLI Example:

salt '*' service.restart <service name>
saltext.alpine.modules.openrc.reload_(name, **_)[source]

Send a reload signal to the named service. Not all services support reload; consult the service’s init script to confirm.

CLI Example:

salt '*' service.reload <service name>
saltext.alpine.modules.openrc.status(name, sig=None, **_)[source]

Return True if the named service is running, False otherwise.

The sig parameter is accepted for interface compatibility with Salt’s generic service state but is not used; rc-service status is authoritative.

CLI Example:

salt '*' service.status <service name>
saltext.alpine.modules.openrc.enabled(name, runlevel=None, **_)[source]

Return True if the named service is enabled in the given runlevel.

runlevel

The runlevel to check. Defaults to ‘default’.

CLI Example:

salt '*' service.enabled <service name>
salt '*' service.enabled <service name> runlevel=boot
saltext.alpine.modules.openrc.disabled(name, **kwargs)[source]

Return True if the named service is disabled in the default runlevel.

CLI Example:

salt '*' service.disabled <service name>
saltext.alpine.modules.openrc.enable(name, runlevel=None, **_)[source]

Enable the named service in the given runlevel so it starts at boot.

runlevel

The runlevel to add the service to. Defaults to ‘default’.

CLI Example:

salt '*' service.enable <service name>
salt '*' service.enable <service name> runlevel=boot
saltext.alpine.modules.openrc.disable(name, runlevel=None, **_)[source]

Disable the named service in the given runlevel.

runlevel

The runlevel to remove the service from. Defaults to ‘default’.

CLI Example:

salt '*' service.disable <service name>
salt '*' service.disable <service name> runlevel=boot
saltext.alpine.modules.openrc.available(name, **_)[source]

Return True if the named service exists on the system.

CLI Example:

salt '*' service.available <service name>
saltext.alpine.modules.openrc.missing(name, **_)[source]

Return True if the named service is not available on the system.

CLI Example:

salt '*' service.missing <service name>
saltext.alpine.modules.openrc.get_all(**_)[source]

Return a sorted list of all services known to rc-service.

CLI Example:

salt '*' service.get_all
saltext.alpine.modules.openrc.get_enabled(runlevel=None, **_)[source]

Return a sorted list of services enabled in the given runlevel.

runlevel

The runlevel to query. Defaults to ‘default’.

CLI Example:

salt '*' service.get_enabled
salt '*' service.get_enabled runlevel=boot
saltext.alpine.modules.openrc.get_running(**_)[source]

Return a sorted list of services that are currently started.

CLI Example:

salt '*' service.get_running