// Exit causes the virtual machine to exit. Do not run outside an // alone app. Exit never returns to the caller. func Exit() { var err error err = syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF) if err != nil { log.Printf("power off failed: %v", err) } err = syscall.Reboot(syscall.LINUX_REBOOT_CMD_HALT) if err != nil { log.Printf("halt failed: %v", err) } os.Exit(1) select {} }
// exit cleanly shuts down the system func halt() { log.Infof("Powering off the system") if strings.HasSuffix(os.Args[0], "-debug") { log.Info("Squashing power off for debug tether") return } syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF) }
func reboot() { log.Infof("Rebooting the system") if strings.HasSuffix(os.Args[0], "-debug") { log.Info("Squashing reboot for debug init") return } syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) }
func reboot() { log.Infof("Rebooting the system") if debugLevel > 0 { log.Info("Squashing reboot for debug init") return } syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) }
// exit cleanly shuts down the system func halt() { log.Infof("Powering off the system") if debugLevel > 0 { log.Info("Squashing power off for debug init") return } syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF) }
func main() { flag.Usage = usage flag.Parse() if flag.NArg() != 0 || (*hflag && *sflag) { usage() } cmd := syscall.LINUX_REBOOT_CMD_CAD_OFF if *hflag { cmd = syscall.LINUX_REBOOT_CMD_CAD_ON } ck(syscall.Reboot(cmd)) }
func reboot(code int) { err := shutDownContainers() if err != nil { log.Error(err) } syscall.Sync() err = syscall.Reboot(code) if err != nil { log.Fatal(err) } }
func main() { flag.Usage = usage flag.Parse() if flag.NArg() != 0 { usage() } syscall.Sync() if *pflag && *rflag { usage() } cmd := syscall.LINUX_REBOOT_CMD_HALT if *pflag { cmd = syscall.LINUX_REBOOT_CMD_POWER_OFF } if *rflag { cmd = syscall.LINUX_REBOOT_CMD_RESTART } ck(syscall.Reboot(cmd)) }
func doReboot() { syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) }
func handleShutdownRequest(w http.ResponseWriter, r *http.Request) { syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF) }
func handleRebootRequest(w http.ResponseWriter, r *http.Request) { syscall.Sync() syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) }