Browse code

Fixing stale pidfile issue when docker dies abruptly Signed-off-by: Mike Leone <mleone896@gmail.com>

fixing indent

Signed-off-by: Mike Leone <mleone896@gmail.com>

Mike Leone authored on 2015/01/23 00:22:40
Showing 1 changed files
... ...
@@ -43,6 +43,8 @@ prestart() {
43 43
 start() {
44 44
     [ -x $exec ] || exit 5
45 45
 
46
+    check_for_cleanup
47
+
46 48
     if ! [ -f $pidfile ]; then
47 49
         prestart
48 50
         printf "Starting $prog:\t"
... ...
@@ -97,6 +99,13 @@ rh_status_q() {
97 97
     rh_status >/dev/null 2>&1
98 98
 }
99 99
 
100
+
101
+check_for_cleanup() {
102
+    if [ -f ${pidfile} ]; then
103
+        /bin/ps -fp $(cat ${pidfile}) > /dev/null || rm ${pidfile}
104
+    fi
105
+}
106
+
100 107
 case "$1" in
101 108
     start)
102 109
         rh_status_q && exit 0