S30tee-supplicant 854 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. DAEMON="tee-supplicant"
  3. PIDFILE="/var/run/$DAEMON.pid"
  4. DAEMON_ARGS="-d /dev/teepriv0"
  5. start() {
  6. printf 'Starting %s: ' "$DAEMON"
  7. # shellcheck disable=SC2086 # we need the word splitting
  8. start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
  9. -- $DAEMON_ARGS
  10. status=$?
  11. if [ "$status" -eq 0 ]; then
  12. echo "OK"
  13. else
  14. echo "FAIL"
  15. fi
  16. return "$status"
  17. }
  18. stop() {
  19. printf 'Stopping %s: ' "$DAEMON"
  20. start-stop-daemon -K -q -p "$PIDFILE"
  21. status=$?
  22. if [ "$status" -eq 0 ]; then
  23. echo "OK"
  24. else
  25. echo "FAIL"
  26. fi
  27. return "$status"
  28. }
  29. restart() {
  30. stop
  31. sleep 1
  32. start
  33. }
  34. case "$1" in
  35. start|stop|restart)
  36. "$1";;
  37. reload)
  38. # Restart, since there is no true "reload" feature (does not
  39. # reconfigure/restart on SIGHUP, just closes all open files).
  40. restart;;
  41. *)
  42. echo "Usage: $0 {start|stop|restart|reload}"
  43. exit 1
  44. esac