1
0
mirror of https://github.com/rancher/os.git synced 2025-06-26 23:06:51 +00:00
os/cmd/power/shutdown.go
Sven Dowideit 4df962d4b6 make ros log to dmesg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-30 10:51:30 +10:00

49 lines
807 B
Go

package power
import (
"os"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
"github.com/rancher/os/log"
)
func Main() {
log.InitLogger()
app := cli.NewApp()
app.Name = os.Args[0]
app.Usage = "Control and configure RancherOS"
app.Version = config.Version
app.Author = "Rancher Labs, Inc."
app.Email = "sid@rancher.com"
app.EnableBashCompletion = true
app.Action = shutdown
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "r, R",
Usage: "reboot after shutdown",
},
cli.StringFlag{
Name: "h",
Usage: "halt the system",
},
}
app.HideHelp = true
app.Run(os.Args)
}
func shutdown(c *cli.Context) error {
common("")
reboot := c.String("r")
poweroff := c.String("h")
if reboot == "now" {
Reboot()
} else if poweroff == "now" {
Off()
}
return nil
}