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() { ...@@ -61,13 +61,12 @@ func main() {
} }
} }
func Native() string { func Native() {
cmd, err := exec.Command("/bin/sh", "pm2 restart 0").Output() out, err := exec.Command("pm2 restart 0").Output()
if err != nil { if err != nil {
fmt.Printf("error %s", err) log.Fatal(err)
} }
output := string(cmd) fmt.Printf("The date is %s\n", out)
return output
} }
func readFile(fname string) { func readFile(fname string) {
...@@ -86,7 +85,7 @@ func readFile(fname string) { ...@@ -86,7 +85,7 @@ func readFile(fname string) {
if err == nil && strings.Contains(string(buf), KEYWORD) { if err == nil && strings.Contains(string(buf), KEYWORD) {
fmt.Printf("%s\n", buf) fmt.Printf("%s\n", buf)
fmt.Println("error found at " + time.Now().String()) 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