Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Arch Linux Sick Beard RC Script

By: postmortem on Dec 7th, 2011  |  syntax: None  |  size: 0.78 KB  |  views: 144  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. #
  3. # *** Arch Linux Sick Beard RC script ***
  4. # Location: /etc/rc.d/sickbeard
  5. #
  6. . /etc/rc.conf
  7. . /etc/rc.d/functions
  8. . /etc/conf.d/sickbeard.conf
  9.  
  10. case "$1" in
  11. start)
  12. stat_busy "Starting Sick-Beard"
  13.  
  14. if [ -f $SB_PIDFILE ]; then
  15. stat_fail
  16. PID=`cat $SB_PIDFILE`
  17. echo "Sick-Beard is already running: $PID"
  18. else
  19.  
  20. su - $SB_USER -c "$SB_PYTHON $SB_BIN -q -d --config $SB_CONF --port $SB_PORT --pidfile $SB_PIDFILE" -s /bin/sh
  21. if [ $? -gt 0 ]; then
  22. stat_fail
  23. else
  24. add_daemon sickbeard
  25. stat_done
  26. fi
  27. fi
  28. ;;
  29. stop)
  30. stat_busy "Stopping Sick-Beard"
  31.  
  32. if [ -f $SB_PIDFILE ]; then
  33. PID=`cat $SB_PIDFILE`
  34. kill -TERM $PID
  35. rm_daemon sickbeard
  36. stat_done
  37. else
  38. stat_fail
  39. fi
  40. ;;
  41. restart)
  42. $0 stop
  43. sleep 1
  44. $0 start
  45. ;;
  46. *)
  47. echo "usage: $0 {start|stop|restart}"
  48. esac
  49. exit 0