Support Docker graceful shutdown

Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
akp 2023-03-23 13:34:38 +00:00
parent fe240195ce
commit 01a0b798e8
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -5,6 +5,7 @@ import (
"errors"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
"github.com/rs/zerolog/log"
@ -69,8 +70,10 @@ func run() error {
}
stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt)
log.Info().Msg("Press Ctrl+C to exit")
signal.Notify(stop, syscall.SIGINT)
signal.Notify(stop, syscall.SIGTERM)
log.Info().Msg("running")
log.Info().Msg("send SIGINT (ctrl+c) or SIGTERM to stop")
<-stop
log.Info().Msg("removing command")