razerd.initscript 986 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: razerd
  4. # Required-Start: $local_fs $remote_fs
  5. # Required-Stop: $local_fs $remote_fs
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: razerd daemon
  9. # Description: Razer device state daemon
  10. ### END INIT INFO
  11. export PATH="/usr/local/bin:$PATH"
  12. NAME=razerd
  13. DAEMON="$(which $NAME)"
  14. PIDFILE="/run/razerd/razerd.pid"
  15. DESC="Razer device state daemon"
  16. . /lib/lsb/init-functions
  17. case "$1" in
  18. start)
  19. log_begin_msg "Starting $DESC: $NAME"
  20. start-stop-daemon --start --quiet --pidfile $PIDFILE \
  21. --oknodo --exec "$DAEMON" -- \
  22. -f -B -P $PIDFILE
  23. log_end_msg $?
  24. ;;
  25. stop)
  26. log_begin_msg "Stopping $DESC: $NAME"
  27. start-stop-daemon --stop --quiet --pidfile $PIDFILE \
  28. --name "$NAME"
  29. RES=$?
  30. rm -f $PIDFILE
  31. log_end_msg $RES
  32. ;;
  33. restart|reload|force-reload)
  34. $0 stop
  35. sleep 1
  36. $0 start
  37. ;;
  38. *)
  39. echo "Usage $0 [start|stop|restart|reload|force-reload]"
  40. exit 1
  41. ;;
  42. esac
  43. exit 0