Advertisement
Guest User

Untitled

a guest
Jul 17th, 2011
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.45 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          Headphones
  5. # Required-Start:    $all
  6. # Required-Stop:     $all
  7. # Default-Start:     2 3 4 5
  8. # Default-Stop:      0 1 6
  9. # Short-Description: starts instance of Headphones
  10. # Description:       starts instance of Headphones using start-stop-daemon
  11. ### END INIT INFO
  12.  
  13. ############### EDIT ME ##################
  14. # path to app
  15. APP_PATH=/home/downloader/headphones/
  16.  
  17. # path to python bin
  18. DAEMON=/usr/bin/python
  19.  
  20. # startup args
  21. DAEMON_OPTS=" headphones.py -q"
  22.  
  23. # script name
  24. NAME=headphones
  25.  
  26. # app name
  27. DESC=Headphones
  28.  
  29. # user
  30. RUN_AS=downloader
  31.  
  32. PID_FILE=/var/run/headphones.pid
  33.  
  34. ############### END EDIT ME ##################
  35.  
  36. test -x $DAEMON || exit 0
  37.  
  38. set -e
  39.  
  40. case "$1" in
  41.   start)
  42.         echo "Starting $DESC"
  43.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
  44.         ;;
  45.   stop)
  46.         echo "Stopping $DESC"
  47.         start-stop-daemon --stop --pidfile $PID_FILE
  48.         ;;
  49.  
  50.   restart|force-reload)
  51.         echo "Restarting $DESC"
  52.         start-stop-daemon --stop --pidfile $PID_FILE
  53.         sleep 15
  54.         start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
  55.         ;;
  56.   *)
  57.         N=/etc/init.d/$NAME
  58.         echo "Usage: $N {start|stop|restart|force-reload}" >&2
  59.         exit 1
  60.         ;;
  61. esac
  62.  
  63. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement