From 066c4b8173b7275ae5793a5d6de9ce29e3469a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 29 Jul 2024 16:28:13 +0200 Subject: [PATCH] only register signal handling once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- ocis/pkg/command/root.go | 2 +- ocis/pkg/runtime/service/service.go | 18 +++++++----------- services/activitylog/cmd/activitylog/main.go | 2 +- services/antivirus/cmd/antivirus/main.go | 2 +- services/app-provider/cmd/app-provider/main.go | 2 +- services/app-registry/cmd/app-registry/main.go | 2 +- services/audit/cmd/audit/main.go | 2 +- services/auth-app/cmd/auth-app/main.go | 2 +- services/auth-basic/cmd/auth-basic/main.go | 2 +- services/auth-bearer/cmd/auth-bearer/main.go | 2 +- services/auth-machine/cmd/auth-machine/main.go | 2 +- services/auth-service/cmd/auth-service/main.go | 2 +- services/clientlog/cmd/clientlog/main.go | 2 +- services/eventhistory/cmd/eventhistory/main.go | 2 +- services/frontend/cmd/frontend/main.go | 2 +- services/gateway/cmd/gateway/main.go | 2 +- services/graph/cmd/graph/main.go | 2 +- services/groups/cmd/groups/main.go | 2 +- services/idm/cmd/idm/main.go | 2 +- services/idp/cmd/idp/main.go | 2 +- services/invitations/cmd/invitations/main.go | 2 +- services/nats/cmd/nats/main.go | 2 +- .../notifications/cmd/notifications/main.go | 2 +- services/ocdav/cmd/ocdav/main.go | 2 +- services/ocm/cmd/ocm/main.go | 2 +- services/ocs/cmd/ocs/main.go | 2 +- services/policies/cmd/policies/main.go | 2 +- .../postprocessing/cmd/postprocessing/main.go | 2 +- services/proxy/cmd/proxy/main.go | 2 +- services/search/cmd/search/main.go | 2 +- services/settings/cmd/settings/main.go | 2 +- services/sharing/cmd/sharing/main.go | 2 +- services/sse/cmd/sse/main.go | 2 +- .../cmd/storage-publiclink/main.go | 2 +- .../storage-shares/cmd/storage-shares/main.go | 2 +- .../storage-system/cmd/storage-system/main.go | 2 +- .../storage-users/cmd/storage-users/main.go | 2 +- services/store/cmd/store/main.go | 2 +- services/thumbnails/cmd/thumbnails/main.go | 2 +- services/userlog/cmd/userlog/main.go | 2 +- services/users/cmd/user/main.go | 2 +- services/web/cmd/web/main.go | 2 +- services/webdav/cmd/webdav/main.go | 2 +- services/webfinger/cmd/webfinger/main.go | 2 +- 44 files changed, 50 insertions(+), 54 deletions(-) diff --git a/ocis/pkg/command/root.go b/ocis/pkg/command/root.go index 666ee0544..6dd7136e4 100644 --- a/ocis/pkg/command/root.go +++ b/ocis/pkg/command/root.go @@ -28,6 +28,6 @@ func Execute() error { ) } - ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) return app.RunContext(ctx, os.Args) } diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go index eac779809..311d6f7c1 100644 --- a/ocis/pkg/runtime/service/service.go +++ b/ocis/pkg/runtime/service/service.go @@ -7,10 +7,8 @@ import ( "net/http" "net/rpc" "os" - "os/signal" "sort" "strings" - "syscall" "time" authapp "github.com/owncloud/ocis/v2/services/auth-app/pkg/command" @@ -362,9 +360,8 @@ func Start(ctx context.Context, o ...Option) error { return err } - // halt listens for interrupt signals and blocks. - halt := make(chan os.Signal, 1) - signal.Notify(halt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) + // get a cancel function to stop the service + ctx, cancel := context.WithCancel(ctx) // tolerance controls backoff cycles from the supervisor. tolerance := 5 @@ -376,7 +373,7 @@ func Start(ctx context.Context, o ...Option) error { if e.Type() == suture.EventTypeBackoff { totalBackoff++ if totalBackoff == tolerance { - halt <- os.Interrupt + cancel() } } s.Log.Info().Str("event", e.String()).Msg(fmt.Sprintf("supervisor: %v", e.Map()["supervisor_name"])) @@ -424,8 +421,8 @@ func Start(ctx context.Context, o ...Option) error { // https://pkg.go.dev/github.com/thejerf/suture/v4@v4.0.0#Supervisor go s.Supervisor.ServeBackground(s.context) - // trap will block on halt channel for interruptions. - go trap(s, halt) + // trap will block on context done channel for interruptions. + go trap(s, ctx) for i, service := range s.Services { scheduleServiceTokens(s, service) @@ -508,9 +505,8 @@ func (s *Service) List(_ struct{}, reply *string) error { // trap blocks on halt channel. When the runtime is interrupted it // signals the controller to stop any supervised process. -func trap(s *Service, halt chan os.Signal) { - <-halt - s.cancel() +func trap(s *Service, ctx context.Context) { + <-ctx.Done() for sName := range s.serviceToken { for i := range s.serviceToken[sName] { if err := s.Supervisor.Remove(s.serviceToken[sName][i]); err != nil { diff --git a/services/activitylog/cmd/activitylog/main.go b/services/activitylog/cmd/activitylog/main.go index a8555bd20..dae55b4f1 100644 --- a/services/activitylog/cmd/activitylog/main.go +++ b/services/activitylog/cmd/activitylog/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/antivirus/cmd/antivirus/main.go b/services/antivirus/cmd/antivirus/main.go index 174e6fe3f..8f0332ad1 100644 --- a/services/antivirus/cmd/antivirus/main.go +++ b/services/antivirus/cmd/antivirus/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/app-provider/cmd/app-provider/main.go b/services/app-provider/cmd/app-provider/main.go index 42b66fd9c..1d7474d45 100644 --- a/services/app-provider/cmd/app-provider/main.go +++ b/services/app-provider/cmd/app-provider/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/app-registry/cmd/app-registry/main.go b/services/app-registry/cmd/app-registry/main.go index e00af3f2a..ddb4faa29 100644 --- a/services/app-registry/cmd/app-registry/main.go +++ b/services/app-registry/cmd/app-registry/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/audit/cmd/audit/main.go b/services/audit/cmd/audit/main.go index 8b33880d6..56413c60b 100644 --- a/services/audit/cmd/audit/main.go +++ b/services/audit/cmd/audit/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/auth-app/cmd/auth-app/main.go b/services/auth-app/cmd/auth-app/main.go index d6cdb39e0..ada20d1af 100644 --- a/services/auth-app/cmd/auth-app/main.go +++ b/services/auth-app/cmd/auth-app/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/auth-basic/cmd/auth-basic/main.go b/services/auth-basic/cmd/auth-basic/main.go index 784d715be..6235d5da7 100644 --- a/services/auth-basic/cmd/auth-basic/main.go +++ b/services/auth-basic/cmd/auth-basic/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/auth-bearer/cmd/auth-bearer/main.go b/services/auth-bearer/cmd/auth-bearer/main.go index 4bc12ab09..8cab6c04a 100644 --- a/services/auth-bearer/cmd/auth-bearer/main.go +++ b/services/auth-bearer/cmd/auth-bearer/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/auth-machine/cmd/auth-machine/main.go b/services/auth-machine/cmd/auth-machine/main.go index aeb79d5cc..f2b0bdc36 100644 --- a/services/auth-machine/cmd/auth-machine/main.go +++ b/services/auth-machine/cmd/auth-machine/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/auth-service/cmd/auth-service/main.go b/services/auth-service/cmd/auth-service/main.go index 81ce1579e..70b2c3d7f 100644 --- a/services/auth-service/cmd/auth-service/main.go +++ b/services/auth-service/cmd/auth-service/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/clientlog/cmd/clientlog/main.go b/services/clientlog/cmd/clientlog/main.go index cdd91f273..9c6595c60 100644 --- a/services/clientlog/cmd/clientlog/main.go +++ b/services/clientlog/cmd/clientlog/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/eventhistory/cmd/eventhistory/main.go b/services/eventhistory/cmd/eventhistory/main.go index 4a1d3f870..47eb6483c 100644 --- a/services/eventhistory/cmd/eventhistory/main.go +++ b/services/eventhistory/cmd/eventhistory/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/frontend/cmd/frontend/main.go b/services/frontend/cmd/frontend/main.go index 8e12e7761..a3e887680 100644 --- a/services/frontend/cmd/frontend/main.go +++ b/services/frontend/cmd/frontend/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/gateway/cmd/gateway/main.go b/services/gateway/cmd/gateway/main.go index 503e12de1..766b15bcf 100644 --- a/services/gateway/cmd/gateway/main.go +++ b/services/gateway/cmd/gateway/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/graph/cmd/graph/main.go b/services/graph/cmd/graph/main.go index 0775fcb48..b0d9189e0 100644 --- a/services/graph/cmd/graph/main.go +++ b/services/graph/cmd/graph/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/groups/cmd/groups/main.go b/services/groups/cmd/groups/main.go index d13447d49..c1d4afadb 100644 --- a/services/groups/cmd/groups/main.go +++ b/services/groups/cmd/groups/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/idm/cmd/idm/main.go b/services/idm/cmd/idm/main.go index ab6af89f2..e61c15349 100644 --- a/services/idm/cmd/idm/main.go +++ b/services/idm/cmd/idm/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/idp/cmd/idp/main.go b/services/idp/cmd/idp/main.go index d3def5ab1..de20d3a5b 100644 --- a/services/idp/cmd/idp/main.go +++ b/services/idp/cmd/idp/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/invitations/cmd/invitations/main.go b/services/invitations/cmd/invitations/main.go index 86da31fcb..8c9a45aea 100644 --- a/services/invitations/cmd/invitations/main.go +++ b/services/invitations/cmd/invitations/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/nats/cmd/nats/main.go b/services/nats/cmd/nats/main.go index 2e75edad3..347a2cc3e 100644 --- a/services/nats/cmd/nats/main.go +++ b/services/nats/cmd/nats/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/notifications/cmd/notifications/main.go b/services/notifications/cmd/notifications/main.go index 1836a24f8..73f31b88f 100644 --- a/services/notifications/cmd/notifications/main.go +++ b/services/notifications/cmd/notifications/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/ocdav/cmd/ocdav/main.go b/services/ocdav/cmd/ocdav/main.go index 964af1667..5a6d24390 100644 --- a/services/ocdav/cmd/ocdav/main.go +++ b/services/ocdav/cmd/ocdav/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/ocm/cmd/ocm/main.go b/services/ocm/cmd/ocm/main.go index 6a4b7926d..77a2913ba 100644 --- a/services/ocm/cmd/ocm/main.go +++ b/services/ocm/cmd/ocm/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/ocs/cmd/ocs/main.go b/services/ocs/cmd/ocs/main.go index 8ae7d0262..96de1a08e 100644 --- a/services/ocs/cmd/ocs/main.go +++ b/services/ocs/cmd/ocs/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/policies/cmd/policies/main.go b/services/policies/cmd/policies/main.go index 09abb5e85..e774e8c4a 100644 --- a/services/policies/cmd/policies/main.go +++ b/services/policies/cmd/policies/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/postprocessing/cmd/postprocessing/main.go b/services/postprocessing/cmd/postprocessing/main.go index e42d50ccd..869d23db0 100644 --- a/services/postprocessing/cmd/postprocessing/main.go +++ b/services/postprocessing/cmd/postprocessing/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/proxy/cmd/proxy/main.go b/services/proxy/cmd/proxy/main.go index 9c51a443e..889bc6772 100644 --- a/services/proxy/cmd/proxy/main.go +++ b/services/proxy/cmd/proxy/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/search/cmd/search/main.go b/services/search/cmd/search/main.go index 807b66427..1426e298d 100644 --- a/services/search/cmd/search/main.go +++ b/services/search/cmd/search/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/settings/cmd/settings/main.go b/services/settings/cmd/settings/main.go index 8833af4bb..965c63854 100644 --- a/services/settings/cmd/settings/main.go +++ b/services/settings/cmd/settings/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/sharing/cmd/sharing/main.go b/services/sharing/cmd/sharing/main.go index cb5b4e5cc..c059753eb 100644 --- a/services/sharing/cmd/sharing/main.go +++ b/services/sharing/cmd/sharing/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/sse/cmd/sse/main.go b/services/sse/cmd/sse/main.go index 9b31eea52..4e951b925 100644 --- a/services/sse/cmd/sse/main.go +++ b/services/sse/cmd/sse/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/storage-publiclink/cmd/storage-publiclink/main.go b/services/storage-publiclink/cmd/storage-publiclink/main.go index e1637605c..2207a7829 100644 --- a/services/storage-publiclink/cmd/storage-publiclink/main.go +++ b/services/storage-publiclink/cmd/storage-publiclink/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/storage-shares/cmd/storage-shares/main.go b/services/storage-shares/cmd/storage-shares/main.go index 472cf04c8..5a292e0ec 100644 --- a/services/storage-shares/cmd/storage-shares/main.go +++ b/services/storage-shares/cmd/storage-shares/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/storage-system/cmd/storage-system/main.go b/services/storage-system/cmd/storage-system/main.go index 761e1ab23..9f2bdaa45 100644 --- a/services/storage-system/cmd/storage-system/main.go +++ b/services/storage-system/cmd/storage-system/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/storage-users/cmd/storage-users/main.go b/services/storage-users/cmd/storage-users/main.go index 142e5a441..62bf86fd0 100644 --- a/services/storage-users/cmd/storage-users/main.go +++ b/services/storage-users/cmd/storage-users/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/store/cmd/store/main.go b/services/store/cmd/store/main.go index 3bbf8cff8..4384dfab8 100644 --- a/services/store/cmd/store/main.go +++ b/services/store/cmd/store/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/thumbnails/cmd/thumbnails/main.go b/services/thumbnails/cmd/thumbnails/main.go index 9f3cce956..f2e8ce626 100644 --- a/services/thumbnails/cmd/thumbnails/main.go +++ b/services/thumbnails/cmd/thumbnails/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/userlog/cmd/userlog/main.go b/services/userlog/cmd/userlog/main.go index 2df9a2a98..58d53b063 100644 --- a/services/userlog/cmd/userlog/main.go +++ b/services/userlog/cmd/userlog/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/users/cmd/user/main.go b/services/users/cmd/user/main.go index 6d6928932..35d221577 100644 --- a/services/users/cmd/user/main.go +++ b/services/users/cmd/user/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/web/cmd/web/main.go b/services/web/cmd/web/main.go index 2ee45f9ee..2331767f3 100644 --- a/services/web/cmd/web/main.go +++ b/services/web/cmd/web/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/webdav/cmd/webdav/main.go b/services/webdav/cmd/webdav/main.go index 08d0bdbbe..444ea77ff 100644 --- a/services/webdav/cmd/webdav/main.go +++ b/services/webdav/cmd/webdav/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) } diff --git a/services/webfinger/cmd/webfinger/main.go b/services/webfinger/cmd/webfinger/main.go index b67f9ba63..112094e8a 100644 --- a/services/webfinger/cmd/webfinger/main.go +++ b/services/webfinger/cmd/webfinger/main.go @@ -12,7 +12,7 @@ import ( func main() { cfg := defaults.DefaultConfig() - cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + cfg.Context, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP) if err := command.Execute(cfg); err != nil { os.Exit(1) }