All pastes #1763255 Raw Edit

Miscellany

public text v1 · immutable
#1763255 ·published 2010-01-23 21:06 UTC
rendered paste body
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
 start)
	stat_busy "Starting rtorrent"
	su rtorrent -c '/usr/bin/dtach -n /tmp/rtorrent.dtach /usr/bin/rtorrent' &> /dev/null
  if [ $? -gt 0 ]; then
		stat_fail
	else
		stat_done
		add_daemon rtorrent
	fi
	;;
 stop)
	stat_busy "Stopping rtorrent"
	/usr/bin/killall -w -s 2 rtorrent
	if [ $? -gt 0]; then
		stat_fail
	else
		rm_daemon rtorrent
	stat_done
	fi
	;;
 restart)
	$0 stop
	/bin/sleep 1
	$0 start
	;;
 *)
	echo "usage: $0 {start|stop|restart}"
esac
exit 0