Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 vgaeteradocs: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:
 </code> </code>
  
-If no watchdog is available+If no watchdog is available, the status parameter is ''offline''.
- +
-<code bash> +
-# ubus call system watchdog +
-+
-        "status": "offline", +
-        "timeout": 30, +
-        "frequency":+
-+
-</code>+
  
 While there is no UCI configuration available for these options, you can change them in an rc script such as ''/etc/rc.local''. While there is no UCI configuration available for these options, you can change them in an rc script such as ''/etc/rc.local''.
Line 45: Line 34:
 <code bash> <code bash>
 # Change timeout to 60s # Change timeout to 60s
-ubus call system watchdog '{ "timeout": 60 }'+ubus call system watchdog '{"timeout":60}' 
 # Change frequency to 1s # Change frequency to 1s
-ubus call system watchdog '{ "frequency": 1 }'+ubus call system watchdog '{"frequency":1}'
 </code> </code>
  
-To stop the service:+To bypass procd, enable the magicclose feature, stop the service and control the watchdog manually:
  
 <code bash> <code bash>
-ubus call system watchdog '{ "stop": true }'+ubus call system watchdog '{"magicclose":true}' 
 +ubus call system watchdog '{"stop":true}' 
 +while :; do echo 1 > /dev/watchdog; sleep 5; done
 </code> </code>
  
 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 '{"stop": true}' 
-{ 
-        "status": "stopped", 
-        "timeout": 30, 
-        "frequency": 5, 
-        "magicclose": false 
-} 
- 
-# echo 1 > /dev/watchdog 
--ash: can't create /dev/watchdog: Resource busy 
-</code> 
- 
-But if you enable magicclose feature then you have control: 
- 
-<code bash> 
-# ubus call system watchdog '{"magicclose": true}' 
-{ 
-        "status": "running", 
-        "timeout": 30, 
-        "frequency": 5, 
-        "magicclose": true 
-} 
- 
-# ubus call system watchdog '{"stop": true}' 
-{ 
-        "status": "offline", 
-        "timeout": 0, 
-        "frequency": 0, 
-        "magicclose": true 
-} 
- 
-# echo 1 > /dev/watchdog 
-# 
-</code>  
  
 ===== 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 << "EOF" > /etc/usb_watchdog
 #!/bin/sh #!/bin/sh
  
Line 159: Line 113:
  
 (install) (install)
-cat << "EOF" > /etc/init.d/usb_watchdog+cat << "EOI" > /etc/init.d/usb_watchdog
 #!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
  
Line 174: Line 128:
 } }
  
-stop_service() +stop_service() {
-{+
     /etc/usb_watchdog stop     /etc/usb_watchdog stop
 } }
-EOF+EOI
  
-cat << "EOF" > /lib/upgrade/keep.d/usb_watchdog+cat << "EOI" > /lib/upgrade/keep.d/usb_watchdog
 /etc/init.d/usb_watchdog /etc/init.d/usb_watchdog
 /etc/rc.d/ /etc/rc.d/
 /etc/usb_watchdog /etc/usb_watchdog
-EOF+EOI
  
 chmod +x /etc/init.d/usb_watchdog chmod +x /etc/init.d/usb_watchdog
Line 200: Line 153:
  
 esac esac
 +EOF
 +chmod +x /etc/usb_watchdog
 +/etc/usb_watchdog install
 </code> </code>
  
Line 205: Line 161:
  
 <code bash> <code bash>
-wget --no-check-certificate -O /etc/usb_watchdog "https://openwrt.org/_export/code/docs/guide-user/hardware/watchdog?codeblock=6+uclient-fetch -O usb-watchdog.sh "https://openwrt.org/_export/code/docs/guide-user/hardware/watchdog?codeblock=3
-chmod +x /etc/usb_watchdog +. ./usb-watchdog.sh
-/etc/usb_watchdog install+
 </code> </code>
  
  • Last modified: 2023/08/21 09:20
  • by vgaetera