summaryrefslogtreecommitdiff
path: root/internal/cli/serve/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli/serve/command.go')
-rw-r--r--internal/cli/serve/command.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/cli/serve/command.go b/internal/cli/serve/command.go
index 21454933..a4caa265 100644
--- a/internal/cli/serve/command.go
+++ b/internal/cli/serve/command.go
@@ -114,9 +114,15 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Comman
if !*silent {
if notified {
fmt.Println("[INFO] sdnotify: notified")
+ stopCh := make(chan struct{}, 1)
+ if containerCfg.WatchdogSec > 0 {
+ fmt.Printf("[INFO] sdnotify: watchdog enabled, timeout: %d seconds\n", containerCfg.WatchdogSec)
+ sdnotify.StartWatchdog(containerCfg.WatchdogSec, stopCh)
+ }
+
// if notified -> notify about stop
defer func() {
- _, _ = sdnotify.SdNotify(sdnotify.Stopping)
+ stopCh <- struct{}{}
}()
} else {
fmt.Println("[INFO] sdnotify: not notified")