From c540664234c23bfc79d2c18bc9492d4969a9f339 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 26 Jan 2016 11:49:04 +0000 Subject: [PATCH] for now always restart docker daemon, not send HUP as most changes require it Signed-off-by: Justin Cormack --- alpine/packages/hupper/main.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/alpine/packages/hupper/main.go b/alpine/packages/hupper/main.go index b30c4a9e3..b1395f93c 100644 --- a/alpine/packages/hupper/main.go +++ b/alpine/packages/hupper/main.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "log" "os" + "os/exec" "strconv" "syscall" ) @@ -43,15 +44,24 @@ func main() { if n == 0 { continue } - bytes, err := ioutil.ReadFile(huppidfile) - if err != nil { - continue + // a few changes eg debug do not require a daemon restart + // however at present we cannot check changes, and most do + restart := true + if restart { + cmd := exec.Command("service", "docker", "restart") + // not much we can do if it does not restart + _ = cmd.Run() + } else { + bytes, err := ioutil.ReadFile(huppidfile) + if err != nil { + continue + } + pidstring := string(bytes[:]) + pid, err := strconv.Atoi(pidstring) + if err != nil { + continue + } + syscall.Kill(pid, syscall.SIGHUP) } - pidstring := string(bytes[:]) - pid, err := strconv.Atoi(pidstring) - if err != nil { - continue - } - syscall.Kill(pid, syscall.SIGHUP) } }