om-watchdog.init 881 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh /etc/rc.common
  2. #
  3. # Copyright (C) 2011 OpenWrt.org
  4. #
  5. START=11
  6. STOP=11
  7. USE_PROCD=1
  8. NAME=om-watchdog
  9. PROG=/sbin/om-watchdog
  10. get_gpio() {
  11. if [ -r /lib/ar71xx.sh ]; then
  12. . /lib/ar71xx.sh
  13. local board=$(ar71xx_board_name)
  14. case "$board" in
  15. "om2p" | \
  16. "om2p-hs" | \
  17. "om2p-hsv2" | \
  18. "om2p-hsv3" | \
  19. "om5p-acv2")
  20. return 12
  21. ;;
  22. "om2pv2" | \
  23. "om2p-lc")
  24. return 26
  25. ;;
  26. "om5p" | \
  27. "om5p-an")
  28. return 11
  29. ;;
  30. "om5p-ac")
  31. return 17
  32. ;;
  33. "mr600v2")
  34. return 15
  35. ;;
  36. "mr900" | \
  37. "mr900v2" | \
  38. "mr1750" | \
  39. "mr1750v2")
  40. return 16
  41. ;;
  42. esac
  43. else
  44. #we assume it is om1p in this case
  45. return 3
  46. fi
  47. return 255
  48. }
  49. start_service() {
  50. get_gpio
  51. gpio="$?"
  52. [ "$gpio" != "255" ] || return
  53. procd_open_instance
  54. procd_set_param command "${PROG}" "${gpio}"
  55. procd_set_param respawn
  56. procd_close_instance
  57. }