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; }
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.