Beispiel #1
0
		sstats, err := jq.ServerStats()
		if err != nil {
			die("even though I was able to connect to the manager, it failed to tell me its true pid; giving up trying to stop it")
		}

		// though it may actually be running on a remote host and we managed to
		// connect to it via ssh port forwarding; compare the server ip to our
		// own
		myAddr := jobqueue.CurrentIP() + ":" + config.ManagerPort
		sAddr := sstats.ServerInfo.Addr
		if myAddr == sAddr {
			jq.Disconnect()
			stopped = stopdaemon(sstats.ServerInfo.PID, "the manager itself", "manager")
		} else {
			// use the client command to stop it
			stopped = jq.ShutdownServer()

			// since I don't trust using a client connection to shut down the
			// server, double check I can no longer connect
			if stopped {
				jq = connect(1 * time.Second)
				if jq != nil {
					warn("I requested shut down of the remote manager at %s, but it still up!", sAddr)
					stopped = false
				}
			}
		}

		if stopped {
			info("wr manager running at %s was gracefully shut down", sAddr)
		} else {