diff options
| author | Nick White <git@njw.name> | 2020-03-30 15:01:19 +0100 | 
|---|---|---|
| committer | Nick White <git@njw.name> | 2020-03-30 15:01:19 +0100 | 
| commit | 159d9ad3e053346f028bed2bc626e20f377a0f75 (patch) | |
| tree | 0adc0db62b7f7307d7e7991a91beeb8d82fb5087 | |
| parent | 5c3e4fca0e33b92369fc4756c61550193de55f39 (diff) | |
[bookpipeline] Enable real shutdown when bookpipeline has been idle for 5 minutes
| -rw-r--r-- | cmd/bookpipeline/main.go | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go index 8317f3b..bf31cf1 100644 --- a/cmd/bookpipeline/main.go +++ b/cmd/bookpipeline/main.go @@ -795,7 +795,16 @@ func main() {  			}  		case <-shutdownIfQuiet.C:  			if *autoshutdown { -				log.Println("If I was sufficiently brave, now would be the time I would shut down") +				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()) +				}  			}  		}  	} | 
