-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Would like to see signal processing for SIGQUIT and SIGTERM in subsequent versions for proper systemd unit operation. Currently, the systemd unit transitions to a failed state after stopping the service.
Here is a short patch for version 0.21.0:
--- main.go.orig 2023-05-24 16:14:47.781711964 +0300
+++ main.go 2023-05-24 14:09:05.000000000 +0300
@@ -181,6 +181,22 @@
hup := make(chan os.Signal, 1)
reloadCh = make(chan chan error)
signal.Notify(hup, syscall.SIGHUP)
+ term_chan := make(chan os.Signal, 1)
+ signal.Notify(term_chan, syscall.SIGTERM, syscall.SIGQUIT)
+ go func(s <-chan os.Signal) {
+ for {
+ sig := <-s
+ switch sig {
+ case syscall.SIGTERM:
+ level.Info(logger).Log("msg", "Got SIGTERM. Exiting")
+ os.Exit(0)
+ case syscall.SIGQUIT:
+ level.Info(logger).Log("msg", "Got SIGQUIT. Exiting")
+ os.Exit(0)
+ }
+ }
+ }(term_chan)
+
go func() {
for {
select {
n-rodriguez
Metadata
Metadata
Assignees
Labels
No labels