Remove stale pidfiles in the respawn loop
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
4bcd4cc58b
commit
52f3117d3f
10
ssm
10
ssm
|
@ -186,6 +186,14 @@ svc() {
|
||||||
while true; do
|
while true; do
|
||||||
job_success = 0 # Needs to be reset
|
job_success = 0 # Needs to be reset
|
||||||
|
|
||||||
|
# Remove stale pidfiles some services may leave behind
|
||||||
|
# If a pidfile exists at this point in the code, it should be stale.
|
||||||
|
if service_pidfile_remove_stale; then
|
||||||
|
if ! svc_pidfile == "$service_pidfile"; then
|
||||||
|
service_pidfile is file && rm -f "$service_pidfile"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Spawn the process and record the PID
|
# Spawn the process and record the PID
|
||||||
spawn "$@" & job_pid = "$!"
|
spawn "$@" & job_pid = "$!"
|
||||||
|
|
||||||
|
@ -369,6 +377,7 @@ start() {
|
||||||
service_running && return 3
|
service_running && return 3
|
||||||
service_command is file || return 9
|
service_command is file || return 9
|
||||||
|
|
||||||
|
# Preform cgroup checks
|
||||||
if cgroups; then
|
if cgroups; then
|
||||||
if service_cgroup_exclusive; then
|
if service_cgroup_exclusive; then
|
||||||
service_cgroup_procs is empty || return 15
|
service_cgroup_procs is empty || return 15
|
||||||
|
@ -591,6 +600,7 @@ var service_cgroup_kill_signal = 15 # The signal to send to the stray cgroup mem
|
||||||
var service_cgroup_cleanup = 0 # Clean up the cgroup when the main PID exits. Uses service_cgroup_kill_signal.
|
var service_cgroup_cleanup = 0 # Clean up the cgroup when the main PID exits. Uses service_cgroup_kill_signal.
|
||||||
var service_success_exit = 0 # Array, takes exit codes that are to be treated as successful termination.
|
var service_success_exit = 0 # Array, takes exit codes that are to be treated as successful termination.
|
||||||
var service_pidfile_timeout = 15 # How long to wait for unmanaged services to create their pidfiles.
|
var service_pidfile_timeout = 15 # How long to wait for unmanaged services to create their pidfiles.
|
||||||
|
var service_pidfile_remove_stale = 1 # Remove stale pidfiles from unmanaged services.
|
||||||
|
|
||||||
# Global config
|
# Global config
|
||||||
var cgroups = 0 # Enable cgroup-related functions
|
var cgroups = 0 # Enable cgroup-related functions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user