Source

gentoo-overlay / net-p2p / rtorrent / files / rtorrentd.init

Full commit
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-p2p/rtorrent/files/rtorrentd.init,v 1.7 2011/05/09 21:34:21 sochotnicky Exp $

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 \
			--chuid $USER \
			--env HOME="${PWHOME:-/home/$USER}" \
			--name rtorrent \
			--exec /usr/bin/screen -- -D -m -S rtorrentd /usr/bin/rtorrent
	eend $?
}

stop() {
	ebegin "Stopping rtorrent"
	start-stop-daemon --stop --signal 15 \
			--pidfile /var/run/rtorrentd.pid
	eend $?
}