Created
October 30, 2011 16:41
-
-
Save wangyan/1326099 to your computer and use it in GitHub Desktop.
rtorrent satart shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
case "$1" in | |
start) | |
echo -n "Starting rtorrent" | |
su - root -c "screen -A -m -d -S rtorrent /usr/local/bin/rtorrent" & | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping rtorrent" | |
ppid=`ps ax | grep "/usr/local/bin/rtorrent" | grep -v grep | grep -v screen | awk '{ print $1 }'` | |
kill ${ppid} | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting rtorrent" | |
ppid=`ps ax | grep "/usr/local/bin/rtorrent" | grep -v grep | grep -v screen | awk '{ print $1 }'` | |
kill ${ppid} | |
sleep 1 | |
su - root -c "screen -A -m -d -S rtorrent /usr/local/bin/rtorrent" & | |
echo "." | |
;; | |
*) | |
echo "Usage: {start|stop|restart}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment