making filenames more dynamic

This commit is contained in:
Gourav 2016-09-16 21:37:23 +00:00 committed by Renan DelValle
parent 37ed6ddf8f
commit 65b2afd76f

8
pcp.go
View file

@ -5,13 +5,15 @@ import (
"log"
"os"
"os/exec"
"time"
)
func main() {
cmd := exec.Command("sh", "-c", "pmdumptext -m -l -o -d , -c config")
stdout, err := os.Create("./output.txt")
time := time.Now().Format("200601021504")
stdout, err := os.Create("./"+time+".txt")
cmd.Stdout = stdout
fmt.Println("PCP started: ", stdout)
fmt.Println("PCP started: ")
if err != nil {
log.Fatal(err)
@ -22,4 +24,4 @@ func main() {
if err := cmd.Wait(); err != nil {
log.Fatal(err)
}
}
}