mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +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"
|
ebegin "Starting docker config update manager"
|
||||||
|
|
||||||
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/hupper.pid
|
[ -n "${PIDFILE}" ] || PIDFILE=/run/hupper.pid
|
||||||
|
|
||||||
start-stop-daemon --start --quiet \
|
start-stop-daemon --start --quiet \
|
||||||
--background \
|
--background \
|
||||||
@ -31,7 +31,7 @@ stop()
|
|||||||
|
|
||||||
ebegin "Stopping docker config update manager"
|
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}
|
start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
|
||||||
|
|
||||||
|
@ -10,19 +10,25 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
pidfile string
|
huppidfile string
|
||||||
|
pidfile string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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(&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() {
|
func main() {
|
||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
pid := os.Getpid()
|
||||||
|
pidbytes := []byte(strconv.Itoa(pid))
|
||||||
|
_ = ioutil.WriteFile(pidfile, pidbytes, 0644)
|
||||||
|
|
||||||
watch, err := os.Open(path)
|
watch, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Failed to open file", path, err)
|
log.Fatalln("Failed to open file", path, err)
|
||||||
@ -37,7 +43,7 @@ func main() {
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bytes, err := ioutil.ReadFile(pidfile)
|
bytes, err := ioutil.ReadFile(huppidfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user