From 8b60724f7532c22be991cf15e4495e61c8fc7287 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 27 Dec 2023 12:45:21 +0100 Subject: 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. --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.go b/main.go index cba4416..5665d86 100644 --- a/main.go +++ b/main.go @@ -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) } -- cgit v1.2.3-70-g09d2