om-watchdog.init 949 B

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