[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] jenkins: update to init script from latest package

Holger Levsen gitlab at salsa.debian.org
Sat Dec 5 20:10:37 GMT 2020



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
ac0bedf8 by Holger Levsen at 2020-12-05T21:10:26+01:00
jenkins: update to init script from latest package

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- hosts/jenkins/etc/init.d/jenkins


Changes:

=====================================
hosts/jenkins/etc/init.d/jenkins
=====================================
@@ -47,7 +47,7 @@ if [ "$RUN_STANDALONE" = "false" ]; then
     exit 1
 fi
 
-# Make sure there exists a java executable, it may not be allways the case
+# Make sure there exists a java executable, it may not be always the case
 if [ -z "$JAVA" ]; then
     echo "ERROR: No Java executable found in current PATH: $PATH" >&2
     echo "If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path" >&2
@@ -55,9 +55,9 @@ if [ -z "$JAVA" ]; then
 fi
 
 # Which Java versions can be used to run Jenkins
-JAVA_ALLOWED_VERSIONS=( "18" "110" )
+JAVA_ALLOWED_VERSIONS=( "1.8" "11" )
 # Work out the JAVA version we are working with:
-JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')
+JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\([0-9]\{2,\}\|[0-9]\.[0-9]\)\..*".*/\1/p;')
 
 if [[ ${JAVA_ALLOWED_VERSIONS[*]} =~ "$JAVA_VERSION" ]]; then
     echo "Correct java version found" >&2
@@ -140,6 +140,9 @@ do_start()
     #   2 if daemon could not be started
     $DAEMON $DAEMON_ARGS --running && return 1
 
+    # Verify if there is a jenkins process already running without a daemon
+    get_running || return 2
+
     # 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
@@ -164,18 +167,26 @@ do_start()
 
 #
 # Verify that all jenkins processes have been shutdown
-# and if not, then do killall for them
 #
 get_running()
 {
     return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(java)' | grep -v defunct | grep -c . `
 }
 
+#
+# killall jenkins processes that have not been shutdown
+#
 force_stop()
 {
     get_running
     if [ $? -ne 0 ]; then
 	killall -u $JENKINS_USER java daemon || return 3
+         # 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
+             sleep 1
+             get_running && return 0
+         done
+         return 2
     fi
 }
 
@@ -206,11 +217,11 @@ do_stop()
             $DAEMON $DAEMON_ARGS --running || break
         done
         if get_daemon_status; then
-	        force_stop || return 3
+	        force_stop || return "$?"
         fi
 	    ;;
 	*)
-	    force_stop || return 3
+	    force_stop || return "$?"
 	    ;;
     esac
 
@@ -247,7 +258,7 @@ case "$1" in
     do_stop
     case "$?" in
         0|1) log_end_msg 0 ;;
-        2) log_end_msg 1 ; exit 100 ;;
+        2|3) log_end_msg 1 ; exit 100 ;;
     esac
     ;;
   restart|force-reload)



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/ac0bedf80f329a767c18c2044a09d9aa2ed3f5ca

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/ac0bedf80f329a767c18c2044a09d9aa2ed3f5ca
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20201205/0eb58d25/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list