summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-03-30 16:42:59 +0100
committerNick White <git@njw.name>2020-03-30 16:42:59 +0100
commit5d781407401ff85190a464de7732ba3ef00cc9a5 (patch)
treed3ba76d5ecdbb7af86de0d795e11ce8d49ca76d4
parent159d9ad3e053346f028bed2bc626e20f377a0f75 (diff)
[bookpipeline] Clean up autoshutdown
-rw-r--r--cmd/bookpipeline/main.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go
index bf31cf1..7ec57c9 100644
--- a/cmd/bookpipeline/main.go
+++ b/cmd/bookpipeline/main.go
@@ -794,17 +794,18 @@ func main() {
log.Println("Error during analysis", err)
}
case <-shutdownIfQuiet.C:
- if *autoshutdown {
- conn.Log("Shutting down")
- cmd := exec.Command("sudo", "systemctl", "poweroff")
- var stdout, stderr bytes.Buffer
- cmd.Stdout = &stdout
- cmd.Stderr = &stderr
- err := cmd.Run()
- if err != nil {
- conn.Log("Error shutting down, error:", err,
- ", stdout: ", stdout.String(), ", stderr: ", stderr.String())
- }
+ if !*autoshutdown {
+ continue
+ }
+ conn.Log("Shutting down")
+ cmd := exec.Command("sudo", "systemctl", "poweroff")
+ var stdout, stderr bytes.Buffer
+ cmd.Stdout = &stdout
+ cmd.Stderr = &stderr
+ err := cmd.Run()
+ if err != nil {
+ conn.Log("Error shutting down, error:", err,
+ ", stdout: ", stdout.String(), ", stderr: ", stderr.String())
}
}
}