diff options
author | xengineering <me@xengineering.eu> | 2023-12-27 12:45:21 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-12-27 13:05:05 +0100 |
commit | 8b60724f7532c22be991cf15e4495e61c8fc7287 (patch) | |
tree | 63035c850792af06259ecaf62b33bb7e8afc43fe | |
parent | 8ce328fafd9b2ad152f0afc16176cf01e1e66669 (diff) | |
download | ceres-8b60724f7532c22be991cf15e4495e61c8fc7287.tar ceres-8b60724f7532c22be991cf15e4495e61c8fc7287.tar.zst ceres-8b60724f7532c22be991cf15e4495e61c8fc7287.zip |
Shutdown only on OS signal
This is the intended behaviour for production and also for debugging to
at least inspect the data directory of Ceres.
-rw-r--r-- | main.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1,6 +1,11 @@ package main import ( + "log" + "os" + "os/signal" + "syscall" + "xengineering.eu/ceres/model" ) @@ -10,4 +15,10 @@ func main() { model.InitDatabase() defer model.CloseDatabase() + + listener := make(chan os.Signal) + signal.Notify(listener, syscall.SIGTERM) + signal.Notify(listener, syscall.SIGINT) + sig := <-listener + log.Printf("Cleaning up due to OS signal '%v'\n", sig) } |