|
|
|
@ -203,6 +203,24 @@ do_stop() {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
force_stop() {
|
|
|
|
|
[[ -f $pid_file ]] || { echoYellow "Not running (pidfile not found)"; return 0; }
|
|
|
|
|
pid=$(cat "$pid_file")
|
|
|
|
|
isRunning "$pid" || { echoYellow "Not running (process ${pid}). Removing stale pid file."; rm -f "$pid_file"; return 0; }
|
|
|
|
|
do_force_stop "$pid" "$pid_file"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_force_stop() {
|
|
|
|
|
kill -9 "$1" &> /dev/null || { echoRed "Unable to kill process $1"; return 1; }
|
|
|
|
|
for i in $(seq 1 60); do
|
|
|
|
|
isRunning "$1" || { echoGreen "Stopped [$1]"; rm -f "$2"; return 0; }
|
|
|
|
|
[[ $i -eq 30 ]] && kill -9 "$1" &> /dev/null
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
echoRed "Unable to kill process $1";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
|
stop && start
|
|
|
|
|
}
|
|
|
|
@ -242,6 +260,8 @@ start)
|
|
|
|
|
start "$@"; exit $?;;
|
|
|
|
|
stop)
|
|
|
|
|
stop "$@"; exit $?;;
|
|
|
|
|
force-stop)
|
|
|
|
|
force_stop "$@"; exit $?;;
|
|
|
|
|
restart)
|
|
|
|
|
restart "$@"; exit $?;;
|
|
|
|
|
force-reload)
|
|
|
|
|