Hello, I run into an issue with the jenkins.init script : it does not stop jenkins process if JENKINS_HOME does not exist and it returns 0 like everything was fine.
In my case /var/lib/jenkins is stored on a NAS, if I start jenkins and then unmount /var/lib/jenkins, jenkins.init stop will not stop jenkins.
It's a problem if you use failover system like corosync to start another jenkins instance in case of failure because the script returns 0 and corosync will assume that jenkins is stopped.
As you can see below, this behavior happens only when you try to stop jenkins, others commands will return 1.
[ -d "$JENKINS_HOME" ] || { echo "JENKINS_HOME directory does not exist: $JENKINS_HOME"; if [ "$1" = "stop" ]; then exit 0; else exit 1; fi; }
[JENKINS-55053] Jenkins init script does not stop jenkins if JENKINS_HOME not found
Component/s | New: packaging [ 20120 ] | |
Component/s | Original: core [ 15593 ] |
Released As | New: 2.335 | |
Assignee | New: Basil Crow [ basil ] | |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Open [ 1 ] | New: Fixed but Unreleased [ 10203 ] |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Resolved [ 5 ] |
As of 2.335, systemctl stop jenkins stops Jenkins (including terminating the Java process) when JENKINS_HOME does not exist. The logic shown in the bug synopsis is no longer executed; therefore, the bug no longer exists.