net-p2p/rtorrent: Fix init script to ensure PID file is created
authorStephen Shkardoon <ss23@ss23.geek.nz>
Sat, 20 Jan 2018 19:46:41 +0000 (08:46 +1300)
committerJason Zaman <perfinion@gentoo.org>
Sun, 21 Jan 2018 04:04:15 +0000 (12:04 +0800)
By only replacing the PID in the stop action, we can ensure
start-stop-daemon had time to create the PID file.

Closes: https://bugs.gentoo.org/634852

Package-Manager: Portage-2.3.19, Repoman-2.3.6

net-p2p/rtorrent/files/rtorrentd.init

index 06fab7d20846c08968c190d3f94f923667af5274..83943cd5661144d5ec3f1ce975bc8fd5b870c5fd 100644 (file)
@@ -21,13 +21,14 @@ start() {
                        --env HOME="${PWHOME:-/home/$USER}" \
                        --name rtorrent \
                        --exec /usr/bin/screen -- -D -m -S rtorrentd /usr/bin/rtorrent
-       # Because we've daemonized with screen, we need to replace the PID file with the real PID of rtorrent
-       pgrep -P $(cat /var/run/rtorrentd.pid) > /var/run/rtorrentd.pid
        eend $?
 }
 
 stop() {
        ebegin "Stopping rtorrent"
+       # Because we've daemonized with screen, we need to replace the PID file with the real PID of rtorrent
+       pgrep -P $(cat /var/run/rtorrentd.pid) > /var/run/rtorrentd.pid
+
        start-stop-daemon --stop --signal 15 \
                        --pidfile /var/run/rtorrentd.pid
        eend $?