mirror of
https://github.com/rancher/os.git
synced 2025-09-16 23:21:19 +00:00
More graceful shutdown and sync before syscall
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
package power
|
||||
|
||||
import(
|
||||
"fmt"
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/rancherio/os/config"
|
||||
)
|
||||
|
||||
@@ -18,27 +17,24 @@ func Main() {
|
||||
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.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) {
|
||||
common()
|
||||
reboot := c.String("r")
|
||||
poweroff := c.String("h")
|
||||
|
||||
fmt.Println(reboot)
|
||||
fmt.Println(poweroff)
|
||||
poweroff := c.String("h")
|
||||
|
||||
if reboot == "now" {
|
||||
Reboot()
|
||||
@@ -46,4 +42,3 @@ func shutdown(c *cli.Context) {
|
||||
PowerOff()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user