Support Docker graceful shutdown
Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
parent
fe240195ce
commit
01a0b798e8
1 changed files with 5 additions and 2 deletions
|
@ -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")
|
||||
|
|
Reference in a new issue