Advertisement
Guest User

xbmc init.d script

a guest
Jul 10th, 2012
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.42 KB | None | 0 0
  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. # startup args
  16. XBMC_BIN_HOME=/usr/local/lib/xbmc
  17. XBMC_HOME=/usr/local/share/xbmc
  18.  
  19. DAEMON=/usr/local/lib/xbmc/xbmc-server.bin
  20.  
  21. DAEMON_OPTS=" --no-test"
  22.  
  23. # script name
  24. NAME=xbmc
  25.  
  26. # app name
  27. DESC=XBMC
  28.  
  29. # user
  30. RUN_AS=root
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement