Runit Operations¶
Manage runit services.
Facts used in these operations: files.File, runit.RunitManaged, runit.RunitStatus.
runit.auto
¶
Start service automatically by managing the service/down
file.
runit.auto(service: str, auto: bool=True, sourcedir: str="/etc/sv")
- service: name of the service to manage
- auto: whether the service should start automatically
- sourcedir: where to search for available services
runit.manage
¶
Manage runit svdir links.
runit.manage(service: str, managed: bool=True, svdir: str="/var/service", sourcedir: str="/etc/sv")
- service: name of the service to manage
- managed: whether the link should exist
- svdir: alternative
SVDIR
- sourcedir: where to search for available services
runit.service
¶
Manage the state of runit services.
runit.service(
service: str, running: bool=True, restarted: bool=False, reloaded: bool=False,
command: Optional[str]=None, enabled: Optional[bool]=None, managed: bool=True,
svdir: str="/var/service", sourcedir: str="/etc/sv",
)
service: name of the service to manage
running: whether the service should be running
restarted: whether the service should be restarted
reloaded: whether the service should be reloaded
command: custom command to pass like:
sv <command> <service>
enabled: whether this service should be enabled/disabled on boot
managed: whether runit should manage this service
For services to be controlled, they first need to be managed by runit by adding a symlink to the service in
SVDIR
. By settingmanaged=False
the symlink will be removed. Other options won’t have any effect after that. Although the<service>/down
file can still be controlled with theenabled
option.svdir: alternative
SVDIR
An alternative
SVDIR
can be specified. This can be used for user services.sourcedir: where to search for available services
An alternative directory for available services can be specified. Example:
sourcedir=/etc/sv.local
for services managed by the administrator.
runit.wait_runsv
¶
Stateless operation
This operation will always execute commands and is not idempotent.
Wait for runsv for service
to be available.
runit.wait_runsv(service: str, svdir: str="/var/service", timeout: int=10)
- service: name of the service to manage
- svdir: alternative
SVDIR
- timeout: time in seconds to wait