fixed runCommand
This commit is contained in:
parent
21c99ce8f6
commit
1b14fcbea4
3
main.go
3
main.go
@ -140,12 +140,13 @@ func block(config sunsetConfig, command string) {
|
|||||||
nextHr, nextMin := getNextWait(config)
|
nextHr, nextMin := getNextWait(config)
|
||||||
timer := time.NewTimer((time.Duration(nextHr) * time.Hour) + (time.Duration(nextMin) * time.Minute))
|
timer := time.NewTimer((time.Duration(nextHr) * time.Hour) + (time.Duration(nextMin) * time.Minute))
|
||||||
<-timer.C
|
<-timer.C
|
||||||
|
log.Printf("Running command: %s\n", command)
|
||||||
go runCommand(command)
|
go runCommand(command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCommand(command string) {
|
func runCommand(command string) {
|
||||||
cmd := exec.Command("/usr/bin/env sh", "-c", command)
|
cmd := exec.Command("/usr/bin/env", "sh", "-c", command)
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Command %s returned a non 0 code", command)
|
log.Printf("Command %s returned a non 0 code", command)
|
||||||
|
Loading…
Reference in New Issue
Block a user