debian init.d script needs to sleep during a restart command

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Hudson does not restart properly when calling "/etc/init.d/hudson restart". When it calls "do_start" java hasn't let go of port 8080 so the restart fails. The solution is to sleep for 2 seconds between stopping and starting:

       
        restart|force-reload)
          #   
          # If the "reload" option is implemented then remove the
          # 'force-reload' alias
          #   
          log_daemon_msg "Restarting $DESC" "$NAME"
          do_stop
          sleep 2 # wait for java to release the port !!
          case "$?" in
            0|1)
              do_start
              case "$?" in
                0) log_end_msg 0 ;;
                1) log_end_msg 1 ;; # Old process is still running
                *) log_end_msg 1 ;; # Failed to start
              esac
              ;;  
            *)  
              # Failed to stop
              log_end_msg 1
              ;;  
          esac
          ;;  
      

            Assignee:
            Unassigned
            Reporter:
            tjwallace
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: