ssm/README.md
fbt e227235f46 examples, oneshot services rework
Signed-off-by: fbt <fbt@fleshless.org>
2018-03-09 02:31:14 +03:00

48 lines
2.6 KiB
Markdown

ssm
===
Yet another service manager.
Services
--------
A service is a script in the ssm's init.d directory.
By default it's /etc/ssm/services for system services and $XDG_CONFIG_HOME/ssm/services for user ones.
Note that they are BASH scripts that get sourced by `ssm`. Same pitfalls apply.
Hopefully, you won't have to do complex logic in the services.
## Global settings
* `cgroups = 0` — Enable cgroup-related features.
## Service config
Mandatory options:
* `service_command = /usr/bin/example -a --long-arg "parameter"`
Optional settings (incomplete list):
* `service_respawn = no` — Restart the service. Takes `no`, `always`, `on-failure` and `on-success`.
* `service_workdir = /`
* `service_pidfile` — If the service manages its own pidfile, set this.
* `service_pidfile_timeout = 15` — How long to wait for the service to create its pidfile.
* `service_pidfile_remove_stale = yes` — Remove stale pidfiles before spawning the service process.
* `service_logfile_out = "$logdir/$service_name.log"` — Logfile for output.
* `service_logfile_err = "$service_logfile_out"` — Logfile for stderr.
* `service_stop_timeout = 30` — How long to wait after sending the stop command.
* `service_ready_timeout = 15` — How long to wait till the service is ready, in seconds.
* `service_stop_signal = 15` — Which signal to send to the service when stopping.
* `service_reload_signal = 1` — Which signal to send to the service when reloading.
* `service_cgroup_exclusive = no` — Refuse to start the service if the cgroup is not empty.
* `service_cgroup_wait = no` — Wait on the entire cgroup to die when stopping the service.
* `service_cgroup_strict = 1` — Refuse to do anything if the service's recorded PID is both running and not in the service's appropriate cgroup. This usually means you've either found a bug or something bad happened to your system.
* `service_cgroup_kill = no` — Kill the entire cgroup when stopping the service.
* `service_cgroup_kill_signal = 15` — Which signal to use for that.
* `service_cgroup_cleanup = no` — Kill the entire cgroup on watchdog cleanup. Note that it is distinctly not the same as killing the cgroup on stopping.
* `service_success_exit = 0` — Array. Which exit codes to treat as successful termination. Only works for managed services (With no custom pidfile).
* `service_oneshot = no` — The service is supposed to do something and die instead of daemonizing.
* `service_signals_passthru` — Array, empty by default. Which signals should the svc pass directly to the service mainpid. This is dangerous, use with caution.
Mind your expansions.