示例#1
0
文件: exit.go 项目: jteso/alone
// 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 {}
}
示例#2
0
文件: main_linux.go 项目: vmware/vic
// 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)
}
示例#3
0
文件: main_linux.go 项目: kjplatz/vic
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)
}
示例#4
0
文件: main_linux.go 项目: vmware/vic
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)
}
示例#5
0
文件: main_linux.go 项目: vmware/vic
// 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)
}
示例#6
0
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))
}
示例#7
0
文件: power.go 项目: jgatkinsn/os
func reboot(code int) {
	err := shutDownContainers()
	if err != nil {
		log.Error(err)
	}

	syscall.Sync()

	err = syscall.Reboot(code)
	if err != nil {
		log.Fatal(err)
	}
}
示例#8
0
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))
}
示例#9
0
func doReboot() {
	syscall.Sync()
	syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
}
示例#10
0
func handleShutdownRequest(w http.ResponseWriter, r *http.Request) {
	syscall.Sync()
	syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
}
示例#11
0
func handleRebootRequest(w http.ResponseWriter, r *http.Request) {
	syscall.Sync()
	syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
}