Last active
August 29, 2015 14:06
-
-
Save gak/1e4124fde555ef480fd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- dnsmasq.old 2014-09-03 04:39:53.119771520 +0000 | |
+++ dnsmasq 2014-09-03 05:21:11.718863850 +0000 | |
@@ -143,9 +143,15 @@ | |
# 1 if daemon was already stopped | |
# 2 if daemon could not be stopped | |
# other if a failure occurred | |
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /var/run/dnsmasq/$NAME.pid --name $NAME | |
- RETVAL="$?" | |
- [ "$RETVAL" = 2 ] && return 2 | |
+ | |
+ # -f so it doesn't complain if the file isn't there | |
+ RETVAL=2 | |
+ if [ -f /var/run/dnsmasq/$NAME.pid ]; then | |
+ kill `cat /var/run/dnsmasq/$NAME.pid` | |
+ RETVAL="$?" | |
+ rm /var/run/dnsmasq/$NAME.pid | |
+ fi | |
+ | |
return "$RETVAL" | |
} | |
@@ -164,10 +170,10 @@ | |
# 1 if daemon is dead and pid file exists | |
# 3 if daemon is not running | |
# 4 if daemon status is unknown | |
- start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/$NAME.pid --exec $DAEMON --test > /dev/null | |
+ pidof $NAME > /dev/null | |
case "$?" in | |
- 0) [ -e "/var/run/dnsmasq/$NAME.pid" ] && return 1 ; return 3 ;; | |
- 1) return 0 ;; | |
+ 1) [ -e "/var/run/dnsmasq/$NAME.pid" ] && return 1 ; return 3 ;; | |
+ 0) return 0 ;; | |
*) return 4 ;; | |
esac | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment