Updated status_of_proc to properly deal with stopped process that uses pidfile

This commit is contained in:
2018-10-07 16:11:58 -05:00
parent 795ed0feaa
commit 0ac62b6e9a
2 changed files with 8 additions and 7 deletions

View File

@@ -213,25 +213,26 @@ status_of_proc() {
echo "$NAME is not running" && return 1
fi
else
echo "Cannot read pid file ($pidfile)"
pid=$(pidofproc "$pathname")
if [ "$?" -eq 0 ]; then
echo "Cannot read pid file ($pidfile)"
echo "$NAME running with PID: $pid"
return 4
else
echo "$NAME is not running"
return 3
fi
return 4
fi
else
pid=$(pidofproc "$pathname")
if [ "$?" -eq 0 ]; then
echo "$NAME running with PID: $pid" && return 0
echo "$NAME running with PID: $pid"
return 0
else
echo "$NAME is not runing" && return 3
echo "$NAME is not runing"
return 3
fi
fi
}