Example #1
0
func main() {
	flag.Parse()

	log.SetDebug(debug)
	diag.SetDebug(debug)

	if !debug {
		diag.SetOutput(ioutil.Discard)
	}

	// ExecSSH() should return only with error
	log.Error(ssh.ExecSSH(getAppexecArgs()))

	os.Exit(254)
}
Example #2
0
func main() {
	flag.Parse()

	log.SetDebug(debug)
	diag.SetDebug(debug)

	if !debug {
		diag.SetOutput(ioutil.Discard)
	}

	if appName == "" {
		log.Fatal("--appname not set to correct value")
	}

	// ExecSSH() should return only with error
	log.Error(ssh.ExecSSH(getAppexecArgs()))

	os.Exit(2)
}
Example #3
0
func main() {
	flag.Parse()

	if force {
		pid, err := readIntFromFile("pid")
		if err != nil {
			fmt.Fprintf(os.Stderr, "error reading pid: %v\n", err)
			os.Exit(254)
		}

		if err := syscall.Kill(pid, syscall.SIGKILL); err != nil {
			fmt.Fprintf(os.Stderr, "error sending %v: %v\n", syscall.SIGKILL, err)
			os.Exit(254)
		}
		return
	}

	// ExecSSH() should return only with error
	log.Error(ssh.ExecSSH([]string{"systemctl", "halt"}))
	os.Exit(254)
}