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

modified /etc/rc.d/sickbeard

By: a guest on Oct 31st, 2011  |  syntax: Bash  |  size: 1.02 KB  |  views: 116  |  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. . /etc/rc.conf
  4. . /etc/rc.d/functions
  5. . /etc/conf.d/sickbeard
  6.  
  7. case "$1" in
  8.   start)
  9.     stat_busy "Starting Sick Beard"
  10.  
  11.     if [ -f /var/run/daemons/sickbeard ]; then
  12.             echo -n "Sick Beard is already running as a daemon!"
  13.             stat_fail
  14.     else
  15.             su - ${SICKBEARD_USER} -c "python2 /opt/sickbeard/SickBeard.py --port ${SICKBEARD_PORT}  &> /dev/null &" -s /bin/sh
  16.             if [ $? -gt 0 ]; then
  17.                     stat_fail
  18.             else
  19.                     add_daemon sickbeard
  20.                     stat_done
  21.             fi
  22.     fi
  23.     ;;
  24.   stop)
  25.     stat_busy "Stopping Sick Beard (May take up to a minute to shutdown after this command)"
  26.  
  27.     curl -f "http://localhost:${SICKBEARD_PORT}/home/shutdown/" &> /dev/null
  28.  
  29.     if [ $? -gt 0 ]; then
  30.             stat_fail
  31.     else
  32.             rm_daemon sickbeard
  33.             stat_done
  34.     fi
  35.     ;;
  36.   restart)
  37.     $0 stop
  38.     sleep 1
  39.     $0 start
  40.     ;;
  41.   *)
  42.     echo "usage: $0 {start|stop|restart}"
  43. esac
  44. exit 0
  45.