runit service module (http://smarden.org/runit)
This module is compatible with the service
states,
so it can be used to maintain services using the provider
argument:
myservice:
service:
- running
- provider: runit
Provides virtual service module on systems using runit as init.
Service management rules (sv command):
service $n is ENABLED if file SERVICE_DIR/$n/run exists service $n is AVAILABLE if ENABLED or if file AVAIL_SVR_DIR/$n/run exists service $n is DISABLED if AVAILABLE but not ENABLED
SERVICE_DIR/$n is normally a symlink to a AVAIL_SVR_DIR/$n folder
Service auto-start/stop mechanism:
sv (auto)starts/stops service as soon as SERVICE_DIR/<service> is created/deleted, both on service creation or a boot time.
autostart feature is disabled if file SERVICE_DIR/<n>/down exists. This does not affect the current's service status (if already running) nor manual service management.
Service's alias:
Service sva is an alias of service svc when AVAIL_SVR_DIR/sva symlinks to folder AVAIL_SVR_DIR/svc. svc can't be enabled if it is already enabled through an alias already enabled, since sv files are stored in folder SERVICE_DIR/svc/.
XBPS package management uses a service's alias to provides service alternative(s), such as chrony and openntpd both aliased to ntpd.
Add a path that may contain available services.
Return True
if added (or already present), False
on error.
directory to add to AVAIL_SVR_DIRS
Returns True
if the specified service is available, otherwise returns
False
.
the service's name
CLI Example:
salt '*' runit.available <service name>
Don't start service name
at boot
Returns True
if operation is successful
the service's name
if True, also stops the service
CLI Example:
salt '*' service.disable <name> [stop=True]
Return True
if the named service is disabled, False
otherwise
the service's name
CLI Example:
salt '*' service.disabled <service name>
Start service name
at boot.
Returns True
if operation is successful
the service's name
If True
, start the service once enabled.
CLI Example:
salt '*' service.enable <name> [start=True]
Return True
if the named service is enabled, False
otherwise
the service's name
CLI Example:
salt '*' service.enabled <service name>
Calls runit.restart()
the service's name
CLI Example:
salt '*' runit.full_restart <service name>
Return a list of all available services
CLI Example:
salt '*' runit.get_all
Return a list of all disabled services
CLI Example:
salt '*' service.get_disabled
Return a list of all enabled services
CLI Example:
salt '*' service.get_enabled
Returns the list of service's name that are aliased and their alias path(s)
Return list of paths that may contain available services
Return list of broken path(s) in SERVICE_DIR that match name
A path is broken if it is a broken symlink or can not be a runit service
a glob for service name. default is '*'
CLI Example:
salt '*' runit.get_svc_broken_path <service name>
The inverse of runit.available.
Returns True
if the specified service is not available, otherwise returns
False
.
the service's name
CLI Example:
salt '*' runit.missing <service name>
Reload service
the service's name
CLI Example:
salt '*' runit.reload <service name>
Remove the service <name> from system.
Returns True
if operation is successful.
The service will be also stopped.
the service's name
CLI Example:
salt '*' service.remove <name>
Restart service
the service's name
CLI Example:
salt '*' runit.restart <service name>
Show properties of one or more units/jobs or the manager
the service's name
CLI Example:
salt '*' service.show <service name>
Start service
the service's name
CLI Example:
salt '*' runit.start <service name>
Return True
if service is running
the service's name
signature to identify with ps
CLI Example:
salt '*' runit.status <service name>
Return True
if service <name> is autostarted by sv
(file $service_folder/down does not exist)
NB: return False
if the service is not enabled.
the service's name
CLI Example:
salt '*' runit.status_autostart <service name>
Stop service
the service's name
CLI Example:
salt '*' runit.stop <service name>