User Tools

Site Tools


uphp:functions:init_watchdog

init_watchdog

WMPRO, WMMINI FW >= 1.1112 WMMEGA FW >= 2.1113

Initialize the software watchdog timer

Description

init_watchdog ( int $interval )

Initializes the watchdog timer. This auto-increments in firmware once per second and when it reaches the preset threshold the Wattmon will reset and reboot. This is implemented to prevent issues if long running scripts block the system.

Parameters

$interval: Interval in seconds (threshold value)

Set this value to 0 to disable the watchdog reboot timer in software.

The default value (as set by the operating system) is 300 seconds (5 minutes).

In the default operating system, and depending upon the system load and memory usage, values below about 65 can cause occasional reboots, and a value of 60 or below is gauranteed to reboot the system constantly.

Return Values

None

Example

<?
  init_watchdog(600); // set the reset interval to 10 minutes
?>

Additional Information

The watchdog timer count is reset to zero by clear_watchdog, which must be called regularly to ensure the counter does not overflow, causing a reboot. By default, in WattmonOS 2.26 and above, clear_watchdog is called from cronmin.cgi once per minute, and the default threshold value is 300 seconds (5 minutes). Therefore, if cronmin.cgi does not complete at least once during 5 minutes the system will reboot.

The interval value for the watchdog timer can be loaded at startup by adding the watchdog_interval key in the debug section of config/uphp.ini, example for 10 minutes:

[debug]
watchdog_interval=600
...

If a timeout occurs the following type of entry is placed in the System Log:

Wed Aug 08 02:27:33 2018: Error: Rebooting due to software watchdog timeout

This function must be used if you are writing a script that might run longer than 5 minutes, which could possibly keep cronmin.cgi from being able to run, depending on how many scripts can run at the same time. Or it might be needed if the default cronmin.cgi is not used.

Also See

clear_watchdog() - Clear the software watchdog timer

uphp/functions/init_watchdog.txt · Last modified: 2021/09/13 05:57 (external edit)