tSwitch the initscripts to supervise-daemon. - tordam - A library for peer discovery inside the Tor network
HTML git clone https://git.parazyd.org/tordam
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 81c0995b7351efe895b5d1e78a1083861cd9cbaa
DIR parent ca200bf9085b61c56fc9c54a5cb480fd98a24b08
HTML Author: parazyd <parazyd@dyne.org>
Date: Wed, 21 Mar 2018 15:40:33 +0100
Switch the initscripts to supervise-daemon.
Diffstat:
M contrib/dam-client.init | 14 ++++++++------
M contrib/dam-dir.init | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
---
DIR diff --git a/contrib/dam-client.init b/contrib/dam-client.init
t@@ -14,14 +14,16 @@ depend() {
start() {
ebegin "Starting $description"
_h="$(getent passwd $damuid | cut -d: -f6)"
- start-stop-daemon --start --background -u $damuid -g $damgid \
- --make-pidfile --pidfile $pidfile \
- --startas /bin/sh -- -c "export HOME=$_h && exec $command >> $damlog 2>&1"
+ supervise-daemon -d $_h -e HOME=$_h -u $damuid -g $damgid \
+ --pidfile $pidfile -1 $damlog -2 $damlog \
+ --start $command
}
stop() {
ebegin "Stopping $description"
- _chld="$(pgrep -P $(cat $pidfile) | tr '\n' ' ')"
- kill $_chld || true
- start-stop-daemon --stop --pidfile $pidfile
+ dcli="$(pgrep -P $(cat $pidfile))"
+ dahs="$(pgrep -P $dcli)"
+ supervise-daemon --stop $command -p $pidfile
+ kill $dahs || true
+ kill $dcli || true
}
DIR diff --git a/contrib/dam-dir.init b/contrib/dam-dir.init
t@@ -15,14 +15,16 @@ depend() {
start() {
ebegin "Starting $description"
_h="$(getent passwd $damuid | cut -d: -f6)"
- start-stop-daemon --start --background -u $damuid -g $damgid \
- --make-pidfile --pidfile $pidfile \
- --startas /bin/sh -- -c "export HOME=$_h && exec $command >> $damlog 2>&1"
+ supervise-daemon -d $_h -e HOME=$_h -u $damuid -g $damgid \
+ --pidfile $pidfile -1 $damlog -2 $damlog \
+ --start $command
}
stop() {
ebegin "Stopping $description"
- _chld="$(pgrep -P $(cat $pidfile) | tr '\n' ' ')"
- kill $_chld || true
- start-stop-daemon --stop --pidfile $pidfile
+ ddir="$(pgrep -P $(cat $pidfile))"
+ rdis="$(pgrep -P $ddir)"
+ supervise-daemon --stop $command -p $pidfile
+ kill $rdis || true
+ kill $ddir || true
}