Debian init script does not wait for shutdown of server

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

XMLWordPrintable

      The stop action of the init script does not wait for the hudson server to finish before returning. This means that a subsequent immediate restart (e.g. the restart action or a package upgrade) does not work since the port is still in use by the old process.

      The following do_stop() function in the init script has been modified to wait correctly:

      do_stop()
      {
          # Return
          #   0 if daemon has been stopped
          #   1 if daemon was already stopped
          #   2 if daemon could not be stopped
          #   other if a failure occurred
          get_daemon_status
          case "$?" in
              0)
                  $DAEMON $DAEMON_ARGS --stop || return 2
                  for n in 0 1 2 3 4; do
                          get_daemon_status || break
                          sleep 1
                  done
                  if get_daemon_status; then
                           force_stop || return 3
                  fi
                  ;;
              *)
                  force_stop || return 3
                  ;;
          esac
      
          # Many daemons don't delete their pidfiles when they exit.
          rm -f $PIDFILE
          return 0
      }
      

            Assignee:
            Unassigned
            Reporter:
            flubdevork
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: