summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go11
1 files changed, 11 insertions, 0 deletions
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)
}