From 49e64f5102d4e9e252f2bd7bdfc1add458b036d7 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Thu, 16 May 2024 22:42:09 +0200 Subject: [PATCH] fix: -notify-sighup should not use signal from -notify-signal --- cmd/docker-gen/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/docker-gen/main.go b/cmd/docker-gen/main.go index 612dc895..c7d96b16 100644 --- a/cmd/docker-gen/main.go +++ b/cmd/docker-gen/main.go @@ -24,6 +24,7 @@ var ( wait string notifyCmd string notifyOutput bool + sighupContainerID string notifyContainerID string notifyContainerSignal int onlyExposed bool @@ -96,7 +97,7 @@ func initFlags() { flag.BoolVar(&includeStopped, "include-stopped", false, "include stopped containers") flag.BoolVar(¬ifyOutput, "notify-output", false, "log the output(stdout/stderr) of notify command") flag.StringVar(¬ifyCmd, "notify", "", "run command after template is regenerated (e.g `restart xyz`)") - flag.StringVar(¬ifyContainerID, "notify-sighup", "", + flag.StringVar(&sighupContainerID, "notify-sighup", "", "send HUP signal to container. Equivalent to docker kill -s HUP `container-ID`") flag.StringVar(¬ifyContainerID, "notify-container", "", "container to send a signal to") @@ -158,6 +159,9 @@ func main() { Interval: interval, KeepBlankLines: keepBlankLines, } + if sighupContainerID != "" { + cfg.NotifyContainers[sighupContainerID] = int(syscall.SIGHUP) + } if notifyContainerID != "" { cfg.NotifyContainers[notifyContainerID] = notifyContainerSignal }