Archived
2
0

fix stopsignal for go program.

This commit is contained in:
Miroslav Šedivý 2021-09-11 18:15:12 +02:00
parent 6ee8bb86fe
commit b7950b3650
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
[supervisord] [supervisord]
nodaemon=true nodaemon=true
user=root
pidfile=/var/run/supervisord.pid pidfile=/var/run/supervisord.pid
logfile=/dev/null logfile=/dev/null
logfile_maxbytes=0 logfile_maxbytes=0
@ -44,6 +45,8 @@ redirect_stderr=true
[program:neko] [program:neko]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
command=/usr/bin/neko serve --static "/var/www" command=/usr/bin/neko serve --static "/var/www"
stopsignal=INT
stopwaitsecs=5
autorestart=true autorestart=true
priority=800 priority=800
user=%(ENV_USER)s user=%(ENV_USER)s

View File

@ -67,6 +67,7 @@ For n.eko room management software, visit https://github.com/m1k1o/neko-rooms.
- Full-screen support for iOS devices. - Full-screen support for iOS devices.
- Added `chrome-sandbox` to fix weird bug when chromium didn't start. - Added `chrome-sandbox` to fix weird bug when chromium didn't start.
- Fixed keyboard mapping on macOS, when CMD could not be used for copy & paste. - Fixed keyboard mapping on macOS, when CMD could not be used for copy & paste.
- Fixed stop signal sent by supervisor to gracefully shut down neko server.
### Misc ### Misc
- Custom docker workflow. - Custom docker workflow.

View File

@ -174,11 +174,11 @@ func (neko *Neko) ServeCommand(cmd *cobra.Command, args []string) {
neko.Start() neko.Start()
neko.logger.Info().Msg("neko ready") neko.logger.Info().Msg("neko ready")
quit := make(chan os.Signal) quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt) signal.Notify(quit, os.Interrupt)
sig := <-quit sig := <-quit
neko.logger.Warn().Msgf("received %s, attempting graceful shutdown: \n", sig) neko.logger.Warn().Msgf("received %s, attempting graceful shutdown", sig)
neko.Shutdown() neko.Shutdown()
neko.logger.Info().Msg("shutdown complete") neko.logger.Info().Msg("shutdown complete")
} }