• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • systemd

      If hudson.lifecycle.ExitLifecycle is selected, jenkins will exit when
      restart is requested. Exit code is taken out of
      jenkins.model.Jenkins.exitCodeOnRestart, default is 5.

      This is usable when there is an external watchdog such as SystemD.

      SystemD service example:

      ExecStart=@/usr/bin/java jenkins $JAVA_OPTIONS -DJENKINS_HOME=${JENKINS_HOME} -Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle -Djenkins.model.Jenkins.exitCodeOnRestart=55 -jar $JENKINS_WAR --debug=${JENKINS_DEBUG_LEVEL} --httpPort=${JENKINS_PORT} --httpListenAddress=${JENKINS_LISTEN_ADDRESS} $JENKINS_ARGS
      

          [JENKINS-47043] Support custom command for Jenkins restart

          Alon Bar-Lev created issue -

          Daniel Beck added a comment -

          exit normally when restarted

          This makes no sense. I mean, if you set up your system to restart automatically when exiting, sure, but think of how this would need to be documented.

          This should have some priority since the /exit URL command is not working.

          If this is about JENKINS-34254, it'd be much better to just fix that rather than hack around it.

          Meanwhile, you could use the CLI command shutdown to get the same result as /exit if it worked.

          Daniel Beck added a comment - exit normally when restarted This makes no sense. I mean, if you set up your system to restart automatically when exiting, sure, but think of how this would need to be documented. This should have some priority since the /exit URL command is not working. If this is about JENKINS-34254 , it'd be much better to just fix that rather than hack around it. Meanwhile, you could use the CLI command shutdown to get the same result as /exit if it worked.

          Alon Bar-Lev added a comment -

          Hi,

           

          > This makes no sense. I mean, if you set up your system to restart automatically when exiting, sure, but think of how this would need to be documented.

          The documentation simply state:

             -DEXIT_ON_RESTART=true - exit jenkins when restarted instead of re-executing the process.
          

          Another alternative, which is actually the current hack I use:

             -DRESTART_PROGRAM=program - execute this program when restarting, default is argv[0] of jenkins process.
          

          This will enable setting the program to be /bin/true to achieve the same effect.

           

          > If this is about JENKINS-34254,

          No it is not, because all the restart features of jenkins (for example post upgrade or plugin update) will not be available also when this issue is fixed.

          This bug should be solved regardless to rescue a jenkins that is at the stage of restart with some failure.

           

          Does it makes more sense now?

          Thanks!

           

          Alon Bar-Lev added a comment - Hi,   > This makes no sense. I mean, if you set up your system to restart automatically when exiting, sure, but think of how this would need to be documented. The documentation simply state:    -DEXIT_ON_RESTART= true - exit jenkins when restarted instead of re-executing the process. Another alternative, which is actually the current hack I use:    -DRESTART_PROGRAM=program - execute this program when restarting, default is argv[0] of jenkins process. This will enable setting the program to be /bin/true to achieve the same effect.   > If this is about JENKINS-34254 , No it is not, because all the restart features of jenkins (for example post upgrade or plugin update) will not be available also when this issue is fixed. This bug should be solved regardless to rescue a jenkins that is at the stage of restart with some failure.   Does it makes more sense now? Thanks!  

          Daniel Beck added a comment -

          Got it, thanks for the explanation.

          Daniel Beck added a comment - Got it, thanks for the explanation.
          Daniel Beck made changes -
          Link New: This issue is related to JENKINS-34254 [ JENKINS-34254 ]

          Alon Bar-Lev added a comment -

          Hi,

          I implemented both options (see below), I prefer the exit.

          Regards,

          Alon

          link Support restartCommand configuration
          link Support exitOnRestart configuration

          Alon Bar-Lev added a comment - Hi, I implemented both options (see below), I prefer the exit. Regards, Alon link Support restartCommand configuration link Support exitOnRestart configuration
          Alon Bar-Lev made changes -
          Remote Link New: This issue links to "Support restartCommand configuration (Web Link)" [ 17755 ]
          Alon Bar-Lev made changes -
          Remote Link New: This issue links to "Support exitOnRestart configuration (Web Link)" [ 17756 ]
          Alon Bar-Lev made changes -
          Labels New: core init-script patch

          Alon Bar-Lev added a comment -

          ping?

          Alon Bar-Lev added a comment - ping?

            Unassigned Unassigned
            alonbl Alon Bar-Lev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: