mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
add pidfile support to hupper
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
b24ce0d678
commit
c0c14ebf23
@ -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}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user