SHARE
TWEET

Untitled

rondadon Jan 18th, 2013 145 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          couchpotato
  5. # Required-Start:    $local_fs $network $remote_fs
  6. # Required-Stop:     $local_fs $network $remote_fs
  7. # Should-Start:      $NetworkManager
  8. # Should-Stop:       $NetworkManager
  9. # Default-Start:     2 3 4 5
  10. # Default-Stop:      0 1 6
  11. # Short-Description: starts instance of CouchPotato
  12. # Description:       starts instance of CouchPotato using start-stop-daemon
  13. ### END INIT INFO
  14.  
  15. ############### EDIT ME ##################
  16.  
  17. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  18. # path to app
  19. APP_PATH=/var/www/CouchPotatoServer/
  20.  
  21. # user
  22. RUN_AS=root
  23.  
  24. # path to python bin
  25. DAEMON=/usr/bin/python
  26.  
  27. # Path to store PID file
  28. PID_FILE=/var/run/couchpotato/server.pid
  29. PID_PATH=$(dirname $PID_FILE)
  30.  
  31. # script name
  32. NAME=couchpotato
  33.  
  34. # app name
  35. DESC="CouchPotato"
  36.  
  37. # startup args
  38. DAEMON_OPTS=" CouchPotato.py --daemon --pid_file=${PID_FILE}"
  39.  
  40. ############### END EDIT ME ##################
  41.  
  42. test -x $DAEMON || exit 0
  43.  
  44. set -e
  45.  
  46. case "$1" in
  47.   start)
  48.         echo "Starting $DESC"
  49.         rm -rf $PID_PATH || return 1
  50.         install -d --mode=0755 -o $RUN_AS $PID_PATH || return 1
  51.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
  52.         ;;
  53.   stop)
  54.         echo "Stopping $DESC"
  55.         start-stop-daemon --stop --pidfile $PID_FILE --retry 15
  56.         ;;
  57.  
  58.   restart|force-reload)
  59.         echo "Restarting $DESC"
  60.         start-stop-daemon --stop --pidfile $PID_FILE --retry 15
  61.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
  62.         ;;
  63.   *)
  64.         N=/etc/init.d/$NAME
  65.         echo "Usage: $N {start|stop|restart|force-reload}" >&2
  66.         exit 1
  67.         ;;
  68. esac
  69.  
  70. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top