commit 827c61575a30fb5af97f94f6de741d93a13a2f77 parent 77feb15fd76bea2b9b1f1814e85b5279954c992e Author: parazyd <parazyd@dyne.org> Date: Mon, 12 Mar 2018 14:31:21 +0100 Add improvements to OpenRC initscripts. Diffstat:
M | contrib/dam-client.init | | | 11 | ++++++++++- |
M | contrib/dam-dir.init | | | 11 | ++++++++++- |
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/contrib/dam-client.init b/contrib/dam-client.init @@ -12,7 +12,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 "exec $command >> $damlog 2>&1" + --startas /bin/sh -- -c "export HOME=$_h && exec $command >> $damlog 2>&1" +} + +stop() { + ebegin "Stopping $description" + _chld="$(pgrep -P $(cat $pidfile) | tr '\n' ' ')" + kill $_chld || true + start-stop-daemon --stop --pidfile $pidfile } diff --git a/contrib/dam-dir.init b/contrib/dam-dir.init @@ -13,7 +13,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 "exec $command >> $damlog 2>&1" + --startas /bin/sh -- -c "export HOME=$_h && exec $command >> $damlog 2>&1" +} + +stop() { + ebegin "Stopping $description" + _chld="$(pgrep -P $(cat $pidfile) | tr '\n' ' ')" + kill $_chld || true + start-stop-daemon --stop --pidfile $pidfile }