aboutsummaryrefslogtreecommitdiff
path: root/daemonize.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-09 23:21:11 +0100
committerJakob Unterwurzacher2015-11-09 23:33:35 +0100
commit51fcf61630905f5dc9370e18522cd0a6c086856d (patch)
tree28fb05508d5c7227b07e01d20360b98e14606473 /daemonize.go
parent273d8086aefdcdbd361d9be31d362b128a3f60f4 (diff)
Use new arg "-notifypid" for more robust daemonization
No more string matching on the parent command line!
Diffstat (limited to 'daemonize.go')
-rw-r--r--daemonize.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/daemonize.go b/daemonize.go
index 32255ca..4f09164 100644
--- a/daemonize.go
+++ b/daemonize.go
@@ -21,7 +21,8 @@ func waitForUsr1() {
func daemonize() {
go waitForUsr1()
name := os.Args[0]
- newArgs := []string{"-f"}
+ notifyArg := fmt.Sprintf("-notifypid=%d", os.Getpid())
+ newArgs := []string{"-f", notifyArg}
newArgs = append(newArgs, os.Args[1:]...)
c := exec.Command(name, newArgs...)
c.Stdout = os.Stdout