Skip to content

Instantly share code, notes, and snippets.

@andrey-utkin
Created April 6, 2018 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrey-utkin/cf3fd47aeacf6dd0657d18e1811dd72f to your computer and use it in GitHub Desktop.
Save andrey-utkin/cf3fd47aeacf6dd0657d18e1811dd72f to your computer and use it in GitHub Desktop.
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 35c642c0..693fe883 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -80,6 +80,12 @@ ssd_stop()
pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
+
+ # Allow restarting a crashed daemon with missing pidfile.
+ # Some daemons remove pidfile when they terminate on their own.
+ # s-s-d fails stopping if pidfile is missing.
+ [ -n "$pidfile" -a ! -e "$pidfile" ] && return 0
+
yesno "${command_progress}" && _progress=--progress
ebegin "Stopping ${name:-$RC_SVCNAME}"
start-stop-daemon --stop \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment