1
0

om-watchdog.init 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. "om2pv4" | \
  17. "om2p-hs" | \
  18. "om2p-hsv2" | \
  19. "om2p-hsv3" | \
  20. "om2p-hsv4" | \
  21. "om5p-acv2")
  22. return 12
  23. ;;
  24. "om2pv2" | \
  25. "om2p-lc")
  26. return 26
  27. ;;
  28. "om5p" | \
  29. "om5p-an")
  30. return 11
  31. ;;
  32. "om5p-ac")
  33. return 17
  34. ;;
  35. "mr600v2")
  36. return 15
  37. ;;
  38. "mr900" | \
  39. "mr900v2" | \
  40. "mr1750" | \
  41. "mr1750v2" | \
  42. "a40" | \
  43. "a60")
  44. return 16
  45. ;;
  46. esac
  47. else
  48. #we assume it is om1p in this case
  49. return 3
  50. fi
  51. return 255
  52. }
  53. start_service() {
  54. get_gpio
  55. gpio="$?"
  56. [ "$gpio" != "255" ] || return
  57. procd_open_instance
  58. procd_set_param command "${PROG}" "${gpio}"
  59. procd_set_param respawn
  60. procd_close_instance
  61. }