razerd.initscript 867 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: razerd
  4. # Required-Start: $local_fs
  5. # Required-Stop: $local_fs
  6. # Default-Start: S 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. # Path to the PID-file
  12. PIDFILE="/var/run/razerd/razerd.pid"
  13. export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
  14. case "$1" in
  15. start)
  16. if razerd -f -B -P "$PIDFILE"; then
  17. echo "Service razerd started."
  18. else
  19. echo "Failed to start razerd."
  20. fi
  21. ;;
  22. stop)
  23. if [ -r "$PIDFILE" ]; then
  24. kill `cat $PIDFILE`
  25. echo "Service razerd stopped."
  26. else
  27. echo "Service razerd is not running."
  28. fi
  29. ;;
  30. restart|reload|force-reload)
  31. $0 stop
  32. sleep 1
  33. $0 start
  34. ;;
  35. *)
  36. echo "Usage $0 [start|stop|restart|reload|force-reload]"
  37. exit 1
  38. ;;
  39. esac
  40. exit 0