cleanup & setup

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2018-03-06 18:21:21 +03:00
parent 88e05630ae
commit 8cee6abd50
2 changed files with 7 additions and 1 deletions

View File

@ -39,3 +39,4 @@ Optional settings (incomplete list):
* `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.

7
ssm
View File

@ -185,6 +185,8 @@ svc() {
fi
fi
run_service_action 'cleanup'
rm -f "$svc_pidfile" "$service_pidfile" "$service_ready_flag"
die 0
@ -219,6 +221,9 @@ svc() {
fi
fi
# Some setup might be required on each loop
run_service_action 'setup'
# Spawn the process and record the PID
spawn "$@" & job_pid = "$!"
@ -428,7 +433,7 @@ start() {
else
svc "${service_command[@]}" &
if timer "$service_ready_timeout" ready; then
if timer "$service_ready_timeout" run_service_action 'ready'; then
set_ready
else
return 5