Verified Commit dcdbf585 authored by Mattia Rizzolo's avatar Mattia Rizzolo
Browse files

merge jenkins init.d with the one coming from the package (mostly whitespace changes)



Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 9c800fa5
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Start Jenkins at boot time # Short-Description: Start Jenkins at boot time
# Description: Controls Jenkins Continuous Integration Server # Description: Controls Jenkins Automation Server
### END INIT INFO ### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="Jenkins Continuous Integration Server" DESC="Jenkins Automation Server"
NAME=jenkins NAME=jenkins
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME
...@@ -87,7 +87,7 @@ check_tcp_port() { ...@@ -87,7 +87,7 @@ check_tcp_port() {
fi fi
count=`netstat --listen --numeric-ports | grep $address\:$port[[:space:]] | grep -c . ` count=`netstat --listen --numeric-ports | grep $address\:$port[[:space:]] | grep -c . `
if [ $count -ne 0 ]; then if [ $count -ne 0 ]; then
echo "The selected $service port ($port) on address $address seems to be in use by another program " echo "The selected $service port ($port) on address $address seems to be in use by another program "
echo "Please select another address/port combination to use for $NAME" echo "Please select another address/port combination to use for $NAME"
...@@ -117,14 +117,14 @@ do_start() ...@@ -117,14 +117,14 @@ do_start()
# Verify that the jenkins port is not already in use, winstone does not exit # Verify that the jenkins port is not already in use, winstone does not exit
# even for BindException # even for BindException
check_tcp_port "http" "$HTTP_PORT" "8080" "$HTTP_HOST" "0.0.0.0" || return 2 check_tcp_port "http" "$HTTP_PORT" "8080" "$HTTP_HOST" "0.0.0.0" || return 2
# If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the # If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the
# proper value # proper value
if [ -n "$MAXOPENFILES" ]; then if [ -n "$MAXOPENFILES" ]; then
[ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES [ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES
ulimit -n $MAXOPENFILES ulimit -n $MAXOPENFILES
fi fi
# notify of explicit umask # notify of explicit umask
if [ -n "$UMASK" ]; then if [ -n "$UMASK" ]; then
[ "$VERBOSE" != no ] && echo Setting umask to $UMASK [ "$VERBOSE" != no ] && echo Setting umask to $UMASK
...@@ -139,16 +139,16 @@ do_start() ...@@ -139,16 +139,16 @@ do_start()
# #
# Verify that all jenkins processes have been shutdown # Verify that all jenkins processes have been shutdown
# and if not, then do killall for them # and if not, then do killall for them
# #
get_running() get_running()
{ {
return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(java)' | grep -v defunct | grep -c . ` return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(java)' | grep -v defunct | grep -c . `
} }
force_stop() force_stop()
{ {
get_running get_running
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
killall -u $JENKINS_USER java daemon || return 3 killall -u $JENKINS_USER java daemon || return 3
fi fi
} }
...@@ -170,9 +170,9 @@ do_stop() ...@@ -170,9 +170,9 @@ do_stop()
# 1 if daemon was already stopped # 1 if daemon was already stopped
# 2 if daemon could not be stopped # 2 if daemon could not be stopped
# other if a failure occurred # other if a failure occurred
get_daemon_status get_daemon_status
case "$?" in case "$?" in
0) 0)
$DAEMON $DAEMON_ARGS --stop || return 2 $DAEMON $DAEMON_ARGS --stop || return 2
# wait for the process to really terminate # wait for the process to really terminate
for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
...@@ -200,7 +200,7 @@ do_check_started_ok() { ...@@ -200,7 +200,7 @@ do_check_started_ok() {
get_running get_running
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
return 2 return 2
else else
return 0 return 0
fi fi
} }
...@@ -251,30 +251,30 @@ case "$1" in ...@@ -251,30 +251,30 @@ case "$1" in
;; ;;
status) status)
get_daemon_status get_daemon_status
case "$?" in case "$?" in
0) 0)
echo "$DESC is running with the pid `cat $PIDFILE`" echo "$DESC is running with the pid `cat $PIDFILE`"
rc=0 rc=0
;; ;;
*) *)
get_running get_running
procs=$? procs=$?
if [ $procs -eq 0 ]; then if [ $procs -eq 0 ]; then
echo -n "$DESC is not running" echo -n "$DESC is not running"
if [ -f $PIDFILE ]; then if [ -f $PIDFILE ]; then
echo ", but the pidfile ($PIDFILE) still exists" echo ", but the pidfile ($PIDFILE) still exists"
rc=1 rc=1
else else
echo echo
rc=3 rc=3
fi fi
else else
echo "$procs instances of jenkins are running at the moment" echo "$procs instances of jenkins are running at the moment"
echo "but the pidfile $PIDFILE is missing" echo "but the pidfile $PIDFILE is missing"
rc=0 rc=0
fi fi
exit $rc exit $rc
;; ;;
esac esac
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment