Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:hardware:watchdog [2020/09/21 09:59] – [USB watchdogs] optimize service management vgaetera | docs:guide-user:hardware:watchdog [2021/11/01 11:39] – [USB watchdogs] vgaetera | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| ===== Controlling the watchdog ===== | ===== Controlling the watchdog ===== | ||
| You can see the current configuration of the watchdog service via ubus: | You can see the current configuration of the watchdog service via ubus: | ||
| - | |||
| - | If there is a watchdog available: | ||
| <code bash> | <code bash> | ||
| Line 30: | Line 28: | ||
| </ | </ | ||
| - | If no watchdog is available: | + | If no watchdog is available, the status |
| - | + | ||
| - | <code bash> | + | |
| - | # ubus call system watchdog | + | |
| - | { | + | |
| - | "status": "offline", | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | </ | + | |
| While there is no UCI configuration available for these options, you can change them in an rc script such as ''/ | While there is no UCI configuration available for these options, you can change them in an rc script such as ''/ | ||
| Line 45: | Line 34: | ||
| <code bash> | <code bash> | ||
| # Change timeout to 60s | # Change timeout to 60s | ||
| - | ubus call system watchdog '{ " | + | ubus call system watchdog ' |
| # Change frequency to 1s | # Change frequency to 1s | ||
| - | ubus call system watchdog '{ " | + | ubus call system watchdog ' |
| </ | </ | ||
| - | To stop the service: | + | To bypass procd, enable the magicclose feature, |
| <code bash> | <code bash> | ||
| - | ubus call system watchdog '{ " | + | ubus call system watchdog ' |
| + | ubus call system watchdog ' | ||
| + | while :; do echo 1 > / | ||
| </ | </ | ||
| Note that watchdog will cause a reset after it expires. | Note that watchdog will cause a reset after it expires. | ||
| - | |||
| - | ===== Manually control hardware watchdog ===== | ||
| - | If you just stop procd from tickling the hardware watchdog you still can't manually tickle watchdog: | ||
| - | |||
| - | <code bash> | ||
| - | # ubus call system watchdog ' | ||
| - | { | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | } | ||
| - | |||
| - | # echo 1 > / | ||
| - | -ash: can't create / | ||
| - | </ | ||
| - | |||
| - | But if you enable magicclose feature then you have control: | ||
| - | |||
| - | <code bash> | ||
| - | # ubus call system watchdog ' | ||
| - | { | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | } | ||
| - | |||
| - | # ubus call system watchdog ' | ||
| - | { | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | } | ||
| - | |||
| - | # echo 1 > / | ||
| - | # | ||
| - | </ | ||
| ===== USB watchdogs ===== | ===== USB watchdogs ===== | ||
| Line 112: | Line 65: | ||
| This is a script that will generate a procd service to control one of such USB-serial watchdogs. | This is a script that will generate a procd service to control one of such USB-serial watchdogs. | ||
| - | <code bash usb_watchdog> | + | <code bash> |
| + | cat << " | ||
| #!/bin/sh | #!/bin/sh | ||
| Line 159: | Line 113: | ||
| (install) | (install) | ||
| - | cat << "EOF" > / | + | cat << "EOI" > / |
| #!/bin/sh / | #!/bin/sh / | ||
| Line 174: | Line 128: | ||
| } | } | ||
| - | stop_service() | + | stop_service() { |
| - | { | + | |
| / | / | ||
| } | } | ||
| - | EOF | + | EOI |
| - | cat << "EOF" > / | + | cat << "EOI" > / |
| / | / | ||
| /etc/rc.d/ | /etc/rc.d/ | ||
| / | / | ||
| - | EOF | + | EOI |
| chmod +x / | chmod +x / | ||
| Line 200: | Line 153: | ||
| esac | esac | ||
| + | EOF | ||
| + | chmod +x / | ||
| + | / | ||
| </ | </ | ||
| Line 205: | Line 161: | ||
| <code bash> | <code bash> | ||
| - | wget --no-check-certificate -O / | + | uclient-fetch -O usb-watchdog.sh |
| - | chmod +x /etc/ | + | . ./usb-watchdog.sh |
| - | / | + | |
| </ | </ | ||