diff --git a/alpine/packages/hupper/etc/init.d/hupper b/alpine/packages/hupper/etc/init.d/hupper index 3057983de..72dd59cf7 100755 --- a/alpine/packages/hupper/etc/init.d/hupper +++ b/alpine/packages/hupper/etc/init.d/hupper @@ -14,7 +14,7 @@ start() ebegin "Starting docker config update manager" - [ -n "${PIDFILE}" ] || PIDFILE=/var/run/hupper.pid + [ -n "${PIDFILE}" ] || PIDFILE=/run/hupper.pid start-stop-daemon --start --quiet \ --background \ @@ -31,7 +31,7 @@ stop() ebegin "Stopping docker config update manager" - [ -n "${PIDFILE}" ] || PIDFILE=/var/run/hupper.pid + [ -n "${PIDFILE}" ] || PIDFILE=/run/hupper.pid start-stop-daemon --stop --quiet --pidfile ${PIDFILE} diff --git a/alpine/packages/hupper/main.go b/alpine/packages/hupper/main.go index 5a9febbf9..b30c4a9e3 100644 --- a/alpine/packages/hupper/main.go +++ b/alpine/packages/hupper/main.go @@ -10,19 +10,25 @@ import ( ) var ( - path string - pidfile string + path string + huppidfile string + pidfile string ) func init() { flag.StringVar(&path, "path", "/Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live", "path of the file to watch") - flag.StringVar(&pidfile, "pidfile", "/run/docker.pid", "pidfile for process to signal") + flag.StringVar(&huppidfile, "huppidfile", "/run/docker.pid", "pidfile for process to signal") + flag.StringVar(&pidfile, "pidfile", "/run/hupper.pid", "my pidfile") } func main() { log.SetFlags(0) flag.Parse() + pid := os.Getpid() + pidbytes := []byte(strconv.Itoa(pid)) + _ = ioutil.WriteFile(pidfile, pidbytes, 0644) + watch, err := os.Open(path) if err != nil { log.Fatalln("Failed to open file", path, err) @@ -37,7 +43,7 @@ func main() { if n == 0 { continue } - bytes, err := ioutil.ReadFile(pidfile) + bytes, err := ioutil.ReadFile(huppidfile) if err != nil { continue }