pwrtray-backend.initscript 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: pwrtray-backend
  4. # Required-Start: $syslog $local_fs dbus bluetooth
  5. # Required-Stop:
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: pwrtray-backend daemon
  9. # Description: Tiny power control daemon
  10. ### END INIT INFO
  11. export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
  12. NAME=pwrtray-backend
  13. DAEMON="$(which $NAME)"
  14. PIDFILE="/run/pwrtray/pwrtray-backend.pid"
  15. DESC="tiny power control 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. -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