Skip to content

Commit

Permalink
[JENKINS-11306] Debian init script: return a proper status code when …
Browse files Browse the repository at this point in the history
…Jenkins is not running.

Originally-From: jenkins-ci.org/commit/core/2f9fff923981c7aeccca9ca88482062a7e578a24
  • Loading branch information
rborer authored and kohsuke committed Nov 8, 2011
1 parent 7a3818f commit 69e2d32
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions debian/jenkins.init
Expand Up @@ -205,27 +205,35 @@ case "$1" in
esac
;;
status)
get_daemon_status
case "$?" in
0) echo "$DESC is running with the pid `cat $PIDFILE`";;
*)
get_running
procs=$?
if [ $procs -eq 0 ]; then
echo -n "$DESC is not running"
if [ -f $PIDFILE ]; then
echo ", but the pidfile ($PIDFILE) still exists"
else
echo
fi

else
echo "$procs instances of jenkins are running at the moment"
echo "but the pidfile $PIDFILE is missing"
fi
;;
esac
;;
get_daemon_status
case "$?" in
0)
echo "$DESC is running with the pid `cat $PIDFILE`"
rc=0
;;
*)
get_running
procs=$?
if [ $procs -eq 0 ]; then
echo -n "$DESC is not running"
if [ -f $PIDFILE ]; then
echo ", but the pidfile ($PIDFILE) still exists"
rc=1
else
echo
rc=3
fi

else
echo "$procs instances of jenkins are running at the moment"
echo "but the pidfile $PIDFILE is missing"
rc=0
fi

exit $rc
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
Expand Down

0 comments on commit 69e2d32

Please sign in to comment.