b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #!/bin/sh /etc/rc.common |
| 2 | # |
| 3 | # Copyright (C) 2011 OpenWrt.org |
| 4 | # |
| 5 | |
| 6 | START=11 |
| 7 | STOP=11 |
| 8 | |
| 9 | USE_PROCD=1 |
| 10 | NAME=om-watchdog |
| 11 | PROG=/sbin/om-watchdog |
| 12 | |
| 13 | get_gpio() { |
| 14 | local board=$(board_name) |
| 15 | |
| 16 | if [ "$board" = "teltonika,rut5xx" ]; then |
| 17 | # ramips |
| 18 | return 11 |
| 19 | else |
| 20 | #we assume it is om1p in this case |
| 21 | return 3 |
| 22 | fi |
| 23 | |
| 24 | return 255 |
| 25 | } |
| 26 | |
| 27 | start_service() { |
| 28 | get_gpio |
| 29 | gpio="$?" |
| 30 | [ "$gpio" != "255" ] || return |
| 31 | |
| 32 | procd_open_instance |
| 33 | procd_set_param command "${PROG}" "${gpio}" |
| 34 | procd_set_param respawn |
| 35 | procd_close_instance |
| 36 | } |