You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-p2p/rtorrent/files/rtorrentd.init

36 lines
871 B

#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
use net ypbind nis
after slapd mysqld postgresql
}
start() {
PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
ebegin "Starting rtorrent"
env TERM="xterm" \
start-stop-daemon \
--start \
--make-pidfile \
--pidfile /var/run/rtorrentd.pid \
--background \
--user $USER \
--env HOME="${PWHOME:-/home/$USER}" \
--name rtorrent \
--exec /usr/bin/screen -- -D -m -S rtorrentd /usr/bin/rtorrent
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 $?
}