Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2009
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/sh
  2. #Start/stop/restart rTorrent as a different system user
  3.  
  4. rtorrent_init() {
  5. if [ -f /home/torrent/rpc.socket ] ; then
  6. rm -f /home/torrent/rpc.socket
  7. fi
  8.  
  9. if [ -f /home/torrent/torrent ] ; then
  10. rm -f /home/torrent/torrent
  11. fi
  12. }
  13.  
  14. rtorrent_start() {
  15. su - torrent -c "dtach -n torrent /usr/local/bin/rtorrent"
  16. }
  17.  
  18. rtorrent_stop() {
  19. killall rtorrent
  20. }
  21.  
  22. case "$1" in
  23. 'start')
  24. echo "Starting rTorrent..."
  25. rtorrent_init
  26. rtorrent_start
  27. ;;
  28. 'stop')
  29. echo "Stopping rTorrent..."
  30. rtorrent_stop
  31. ;;
  32. 'restart')
  33. echo "Restarting rTorrent..."
  34. rtorrent_stop
  35. rtorrent_start
  36. ;;
  37. *)
  38. echo "$0 start|stop|restart"
  39. ;;
  40. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement