1
0
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:
Darren Shepherd
2015-03-14 21:31:11 -07:00
parent ac2459ba37
commit c0b02ca361
2 changed files with 139 additions and 56 deletions

View File

@@ -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()
}
}