Advertisement
Guest User

RPI-cecd init script

a guest
Jul 20th, 2012
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          rpi-cecd
  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 rpi-cecd to enable the remote control
  10. # Description:       starts instance of rpi-cecd to enable the remote control
  11. ### END INIT INFO
  12.  
  13. ############### EDIT ME ##################
  14.  
  15. # path to xinit exec
  16. DAEMON=/home/pi/rpi-cecd/rpi-cecd
  17.  
  18. # script name
  19. NAME=rpi-cecd
  20.  
  21. # app name
  22. DESC=RPI-CECD
  23.  
  24. # user
  25. RUN_AS=pi
  26.  
  27. # Path of the PID file
  28. PID_FILE=/var/run/rpi-cecd.pid
  29.  
  30. ############### END EDIT ME ##################
  31.  
  32. test -x $DAEMON || exit 0
  33.  
  34. set -e
  35.  
  36. case "$1" in
  37.   start)
  38.         echo "Starting $DESC"
  39.         start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON
  40.         ;;
  41.   stop)
  42.         echo "Stopping $DESC"
  43.         start-stop-daemon --stop --pidfile $PID_FILE
  44.         ;;
  45.  
  46.   restart|force-reload)
  47.         echo "Restarting $DESC"
  48.         start-stop-daemon --stop --pidfile $PID_FILE
  49.         sleep 5
  50.         start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON
  51.         ;;
  52.   *)
  53.         N=/etc/init.d/$NAME
  54.         echo "Usage: $N {start|stop|restart|force-reload}" >&2
  55.         exit 1
  56.         ;;
  57. esac
  58.  
  59. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement