commit:     427400b35fe4f1d1cafbad62458e2f5faae8b7e0
Author:     Stephen Shkardoon <ss23 <AT> ss23 <DOT> geek <DOT> nz>
AuthorDate: Sat Jan 20 19:46:41 2018 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 04:04:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=427400b3

net-p2p/rtorrent: Fix init script to ensure PID file is created

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net-p2p/rtorrent/files/rtorrentd.init 
b/net-p2p/rtorrent/files/rtorrentd.init
index 06fab7d2084..83943cd5661 100644
--- a/net-p2p/rtorrent/files/rtorrentd.init
+++ b/net-p2p/rtorrent/files/rtorrentd.init
@@ -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 $?

Reply via email to