net-p2p/amule: update init script
authorAlexander Tsoy <alexander@tsoy.me>
Tue, 27 Oct 2015 13:45:07 +0000 (16:45 +0300)
committerAlexander Tsoy <alexander@tsoy.me>
Tue, 27 Oct 2015 14:05:18 +0000 (17:05 +0300)
- properly pass env variable to the daemon
- replace/remove deprecated start-stop-daemon options
- use portable shell

Gentoo-Bug: 420157

net-p2p/amule/files/amuled.initd
net-p2p/amule/files/amuleweb.initd

index 9b83458b380a8350cee0396142b0916b8df87260..082e2ffe15f2b0743900e397b8e063e5f0d7e7f1 100644 (file)
@@ -22,12 +22,13 @@ start() {
        fi
 
        ebegin "Starting aMule Daemon"
-       env HOME="${AMULEHOME}" start-stop-daemon --start \
+       start-stop-daemon --start \
                --quiet --background \
                --make-pidfile --pidfile /var/run/amuled.pid \
-               -c ${AMULEUSER} \
-               -x /usr/bin/amuled >${LOG}
-       
+               --env HOME="${AMULEHOME}" \
+               --user ${AMULEUSER} \
+               --exec /usr/bin/amuled >${LOG}
+
        sleep 2
        if ! pgrep -u ${AMULEUSER} amuled > /dev/null; then
                eerror "aMule daemon can't be started! Check logfile: ${LOG}"
@@ -37,7 +38,7 @@ start() {
 
 stop() {
        ebegin "Stopping aMule daemon -- please wait"
-       start-stop-daemon --oknodo --stop --pidfile /var/run/amuled.pid &>/dev/null
+       start-stop-daemon --stop --pidfile /var/run/amuled.pid 2>&1 >/dev/null
        eend $?
 }
 
index 0484780093a26a4dec43b330d1fdadee7796ee98..05e7d9f192b8deb6eac0b2f64525a0c56782c280 100644 (file)
@@ -26,12 +26,13 @@ start() {
        OPTIONS="-h ${AMULEHOST} -p ${AMULEPORT} -P ${AMULEPWD} -A ${WEBPWD} -t ${TEMPLATE} -q"
 
        ebegin "Starting aMule WebServer"
-       env HOME="${AMULEHOME}" start-stop-daemon --start \
-               --quiet -b \
+       start-stop-daemon --start \
+               --quiet --background \
                --make-pidfile --pidfile /var/run/amuleweb.pid \
-               -c ${AMULEUSER} \
-               -x /usr/bin/amuleweb -- ${OPTIONS} &>${LOG}
-       
+               --env HOME="${AMULEHOME}" \
+               --user ${AMULEUSER} \
+               --exec /usr/bin/amuleweb -- ${OPTIONS} 2>&1 >${LOG}
+
        sleep 1
        if ! pgrep -u ${AMULEUSER} amuleweb > /dev/null; then
                eerror "aMule daemon can't be started! Check logfile: ${LOG}"
@@ -43,7 +44,7 @@ start() {
 
 stop() {
        ebegin "Stopping aMule WebServer"
-       start-stop-daemon --oknodo --stop --pidfile /var/run/amuleweb.pid &>/dev/null
+       start-stop-daemon --stop --pidfile /var/run/amuleweb.pid 2>&1 >/dev/null
        eend $?
 }