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',
**kwargs,
)
service: name of the service to manage
auto: whether the service should start automatically
sourcedir: where to search for available services
Note
This operation also inherits all global arguments.
runit.manage¶
Manage runit svdir links.
runit.manage(
service: 'str',
managed: 'bool' = True,
svdir: 'str' = '/var/service',
sourcedir: 'str' = '/etc/sv',
**kwargs,
)
service: name of the service to manage
managed: whether the link should exist
svdir: alternative
SVDIRsourcedir: where to search for available services
Note
This operation also inherits all global arguments.
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',
**kwargs,
)
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=Falsethe symlink will be removed. Other options won’t have any effect after that. Although the<service>/downfile can still be controlled with theenabledoption.svdir: alternative
SVDIRAn alternative
SVDIRcan 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.localfor services managed by the administrator.
Note
This operation also inherits all global arguments.
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,
**kwargs,
)
service: name of the service to manage
svdir: alternative
SVDIRtimeout: time in seconds to wait
Note
This operation also inherits all global arguments.
pyinfra 3.x