Commit 3bac3495 authored by nico baruna's avatar nico baruna

add exec command

parent d9a5439a
Pipeline #23028 canceled with stages
......@@ -61,13 +61,12 @@ func main() {
}
}
func Native() string {
cmd, err := exec.Command("/bin/sh", "pm2 restart 0").Output()
func Native() {
out, err := exec.Command("pm2 restart 0").Output()
if err != nil {
fmt.Printf("error %s", err)
log.Fatal(err)
}
output := string(cmd)
return output
fmt.Printf("The date is %s\n", out)
}
func readFile(fname string) {
......@@ -86,7 +85,7 @@ func readFile(fname string) {
if err == nil && strings.Contains(string(buf), KEYWORD) {
fmt.Printf("%s\n", buf)
fmt.Println("error found at " + time.Now().String())
fmt.Println(Native())
Native()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment