om-watchdog.init 1.0 KB

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