コード例 #1
0
ファイル: manager.go プロジェクト: sb10/vrpipe
// reportLiveStatus is used by the status command on a working connection to
// distinguish between the server being in a normal 'started' state or the
// 'drain' state.
func reportLiveStatus(jq *jobqueue.Client) {
	sstats, err := jq.ServerStats()
	if err != nil {
		die("even though I was able to connect to the manager, it wasn't able to tell me about itself: %s", err)
	}
	mode := sstats.ServerInfo.Mode
	fmt.Println(mode)
}
コード例 #2
0
ファイル: manager.go プロジェクト: sb10/vrpipe
			} else {
				info("wr manager running on port %s was gracefully shut down", config.ManagerPort)
				return
			}
		} else {
			// we failed to SIGTERM the pid in the pid file, let's take some
			// time to confirm the daemon is really up
			jq = connect(5 * time.Second)
			if jq == nil {
				die("according to the pid file %s, wr manager for port %s was running with pid %d, but that process could not be terminated and the manager could not be connected to; most likely the pid file is wrong and the manager is not running - after confirming, delete the pid file before trying to start the manager again", config.ManagerPidFile, config.ManagerPort, pid)
			}
		}

		// we managed to connect to the daemon; get it's real pid and try to
		// stop it again
		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()