mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
internal/router: use daemon -r option
So if ctrld is killed unexpectedly, daemon will respawn new ctrld and keep the system DNS working.
This commit is contained in:
committed by
Cuong Manh Le
parent
71f26a6d81
commit
32709dc64c
@@ -137,20 +137,9 @@ rcvar="${name}_enable"
|
||||
pidfile="/var/run/${name}.pid"
|
||||
child_pidfile="/var/run/${name}_child.pid"
|
||||
command="/usr/sbin/daemon"
|
||||
daemon_args="-P ${pidfile} -p ${child_pidfile} -t \"${name}: daemon\"{{if .WorkingDirectory}} -c {{.WorkingDirectory}}{{end}}"
|
||||
daemon_args="-r -P ${pidfile} -p ${child_pidfile} -t \"${name}: daemon\"{{if .WorkingDirectory}} -c {{.WorkingDirectory}}{{end}}"
|
||||
command_args="${daemon_args} {{.Path}}{{range .Arguments}} {{.}}{{end}}"
|
||||
|
||||
stop_cmd="ctrld_stop"
|
||||
|
||||
ctrld_stop() {
|
||||
pid=$(cat ${pidfile})
|
||||
child_pid=$(cat ${child_pidfile})
|
||||
if [ -e "${child_pidfile}" ]; then
|
||||
kill -s TERM "${child_pid}"
|
||||
wait_for_pids "${child_pid}" "${pidfile}"
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config "${name}"
|
||||
run_rc_command "$1"
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user