S11gpio 585 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. #
  3. # Start/stop FunKey GPIO daemon
  4. #
  5. DAEMON=/usr/local/sbin/fkgpiod
  6. case "$1" in
  7. start)
  8. echo -n "Starting FunKey GPIO daemon: "
  9. ${DAEMON} -d /etc/fkgpiod.conf > /dev/null 2>&1
  10. if [ ${?} -eq 0 ]; then
  11. echo "OK"
  12. else
  13. echo "ERROR"
  14. fi
  15. ;;
  16. stop)
  17. echo -n "Stopping FunKey GPIO daemon: "
  18. ${DAEMON} -k > /dev/null 2>&1
  19. if [ ${?} -eq 0 ]; then
  20. echo "OK"
  21. else
  22. echo "ERROR"
  23. fi
  24. ;;
  25. restart)
  26. ${0} stop
  27. sleep 1 # Prevent race condition: ensure FunKey GPIO daemon stops before start.
  28. ${0} start
  29. ;;
  30. *)
  31. echo "Usage: ${0} {start|stop|restart}"
  32. exit 1
  33. esac