예제 #1
0
파일: admin.go 프로젝트: arjloo/skynet
func Stop(q *skynet.Query) {
	cl := client.NewClient(&config)

	for _, instance := range filterDaemon(q.FindInstances()) {
		cdaemon := daemon.GetDaemonForService(cl, instance)

		in := daemon.StopSubServiceRequest{UUID: instance.Config.UUID}
		out, err := cdaemon.StopSubService(in)

		if err != nil {
			if strings.HasPrefix(err.Error(), "No such service UUID") {
				// no daemon on the service's machine, shut it down directly
				AdminStop(q)
			} else {
				fmt.Println(err)
			}
		} else {
			stopTemplate.Execute(os.Stdout, out)
		}
	}
}
예제 #2
0
파일: admin.go 프로젝트: arjloo/skynet
func Restart(q *skynet.Query) {
	cl := client.NewClient(&config)

	for _, instance := range filterDaemon(q.FindInstances()) {
		cdaemon := daemon.GetDaemonForService(cl, instance)

		in := daemon.RestartSubServiceRequest{UUID: instance.Config.UUID}
		out, err := cdaemon.RestartSubService(in)

		if err != nil {
			if strings.HasPrefix(err.Error(), "No such service UUID") {
				// Commented out for now, we need to determine if we want to try to restart an unmanaged instance, and support it
				// no daemon on the service's machine, shut it down directly
				//AdminStop(q)
			} else {
				fmt.Println(err)
			}
		} else {
			restartTemplate.Execute(os.Stdout, out)
		}
	}

}