use go-cmd/cmd

This commit is contained in:
Jeff Carr 2024-11-08 06:44:56 -06:00
parent 121b23720b
commit f45c2ed21e
1 changed files with 3 additions and 2 deletions

View File

@ -37,13 +37,14 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
} }
if tmp == "/lastoutage" { if tmp == "/lastoutage" {
// r := shell.Output("", []string{"ls", "-l", "/"}) // r := shell.Output("", []string{"ls", "-l", "/"})
r := shell.Output("", []string{"pwrstat", "-status"}) r := shell.Run([]string{"pwrstat", "-status"})
// log.Info("ls -l / START") // log.Info("ls -l / START")
// log.Info("ls -l / =", r.Stdout()) // log.Info("ls -l / =", r.Stdout())
// log.Info("ls -l / END") // log.Info("ls -l / END")
fmt.Fprintln(w, r.Stdout()) output := strings.Join(r.Stdout, "\n")
fmt.Fprintln(w, output)
return return
} }
fmt.Fprintln(w, "UNKNOWN URL:", tmp) fmt.Fprintln(w, "UNKNOWN URL:", tmp)