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.
  • Loading branch information
rborer authored and kohsuke committed Nov 8, 2011
1 parent 3b8d287 commit 2f9fff9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -61,6 +61,9 @@
<li class=bug>
java.io.IOException: Unexpected termination of the channel - SEVERE: I/O error in channel Chunked connection when using jenkins-cli.jar (works on older Hudson version)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11130">issue 11130</a>)
<li class=bug>
Debian init script now returns the proper exit code from the 'status' command.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11306">issue 11306</a>)
<li class=rfe>
Sortable table wasn't "stable" when there are same values in different rows
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11551">issue 11551</a>)
Expand Down
50 changes: 29 additions & 21 deletions debian/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 2f9fff9

Please sign in to comment.