diff options
Diffstat (limited to 'hosts/jenkins/etc')
-rwxr-xr-x | hosts/jenkins/etc/init.d/jenkins | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/hosts/jenkins/etc/init.d/jenkins b/hosts/jenkins/etc/init.d/jenkins index 47a783fd..076151e4 100755 --- a/hosts/jenkins/etc/init.d/jenkins +++ b/hosts/jenkins/etc/init.d/jenkins @@ -10,12 +10,12 @@ # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Jenkins at boot time -# Description: Controls Jenkins Continuous Integration Server +# Description: Controls Jenkins Automation Server ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin -DESC="Jenkins Continuous Integration Server" +DESC="Jenkins Automation Server" NAME=jenkins SCRIPTNAME=/etc/init.d/$NAME @@ -87,7 +87,7 @@ check_tcp_port() { fi count=`netstat --listen --numeric-ports | grep $address\:$port[[:space:]] | grep -c . ` - + if [ $count -ne 0 ]; then 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" @@ -117,14 +117,14 @@ do_start() # Verify that the jenkins port is not already in use, winstone does not exit # even for BindException 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 if [ -n "$MAXOPENFILES" ]; then [ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES ulimit -n $MAXOPENFILES fi - + # notify of explicit umask if [ -n "$UMASK" ]; then [ "$VERBOSE" != no ] && echo Setting umask to $UMASK @@ -139,16 +139,16 @@ do_start() # # Verify that all jenkins processes have been shutdown # 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 . ` } -force_stop() +force_stop() { get_running - if [ $? -ne 0 ]; then + if [ $? -ne 0 ]; then killall -u $JENKINS_USER java daemon || return 3 fi } @@ -170,9 +170,9 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - get_daemon_status + get_daemon_status case "$?" in - 0) + 0) $DAEMON $DAEMON_ARGS --stop || return 2 # 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 @@ -200,7 +200,7 @@ do_check_started_ok() { get_running if [ "$?" -eq "0" ]; then return 2 - else + else return 0 fi } @@ -251,30 +251,30 @@ case "$1" in ;; status) get_daemon_status - case "$?" in - 0) + case "$?" in + 0) echo "$DESC is running with the pid `cat $PIDFILE`" rc=0 ;; - *) + *) get_running procs=$? - if [ $procs -eq 0 ]; then + if [ $procs -eq 0 ]; then echo -n "$DESC is not running" - if [ -f $PIDFILE ]; then + if [ -f $PIDFILE ]; then echo ", but the pidfile ($PIDFILE) still exists" rc=1 - else + else echo rc=3 fi - - else + + else echo "$procs instances of jenkins are running at the moment" echo "but the pidfile $PIDFILE is missing" rc=0 fi - + exit $rc ;; esac |