SHARE
TWEET

HTPC-Manager

a guest Mar 27th, 2012 258 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          HTPC-Manager
  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 HTPC-Manager
  12. # Description:       starts instance of HTPC-Manager using start-stop-daemon
  13. ### END INIT INFO
  14.  
  15. ############### EDIT ME ##################
  16. # Path to app
  17. APP_PATH=/path/to/htpc-manager
  18.  
  19. # User
  20. RUN_AS=set user here
  21.  
  22. # Path to python bin
  23. DAEMON=/usr/bin/python
  24.  
  25. # Path to store the PID file
  26. PID_FILE=/var/run/htpc.pid
  27.  
  28. # Script name
  29. NAME=htpc
  30.  
  31. # App name
  32. NAME=htpc
  33.  
  34. # startup args
  35. DAEMON_OPTS=" htpc.py -q --daemon"
  36.  
  37. ############### END EDIT ME ##################
  38.  
  39. test -x $DAEMON || exit 0
  40.  
  41. set -e
  42.  
  43. case "$1" in
  44.   start)
  45.         echo "Starting $DESC"
  46.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile  --exec $DAEMON -- $DAEMON_OPTS
  47.         ;;
  48.   stop)
  49.         echo "Stopping $DESC"
  50.         start-stop-daemon --stop --pidfile $PID_FILE
  51.         ;;
  52.  
  53.   restart|force-reload)
  54.         echo "Restarting $DESC"
  55.         start-stop-daemon --stop --pidfile $PID_FILE
  56.         sleep 15
  57.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
  58.         ;;
  59.   *)
  60.         N=/etc/init.d/$NAME
  61.         echo "Usage: $N {start|stop|restart|force-reload}" >&2
  62.         exit 1
  63.         ;;
  64. esac
  65.  
  66. 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