Powderking

xbmc init.d script

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