From: John Kohl Date: Sun, 5 Jun 2022 01:16:27 +0000 (-0400) Subject: luci-app-watchcat: add support for run_script mode X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ae5677b8c24b7be5cbca5dbef00178b88a1161ac;p=project%2Fluci.git luci-app-watchcat: add support for run_script mode Signed-off-by: John Kohl --- diff --git a/applications/luci-app-watchcat/htdocs/luci-static/resources/view/watchcat.js b/applications/luci-app-watchcat/htdocs/luci-static/resources/view/watchcat.js index 670dfcde32..dc9e0084bc 100644 --- a/applications/luci-app-watchcat/htdocs/luci-static/resources/view/watchcat.js +++ b/applications/luci-app-watchcat/htdocs/luci-static/resources/view/watchcat.js @@ -22,18 +22,27 @@ return view.extend({ _('Mode'), _("Ping Reboot: Reboot this device if a ping to a specified host fails for a specified duration of time.
\ Periodic Reboot: Reboot this device after a specified interval of time.
\ - Restart Interface: Restart a network interface if a ping to a specified host fails for a specified duration of time.")); + Restart Interface: Restart a network interface if a ping to a specified host fails for a specified duration of time.
\ + Run Script: Run a script if a ping to a specified host fails for a specified duration of time.
")); o.value('ping_reboot', _('Ping Reboot')); o.value('periodic_reboot', _('Periodic Reboot')); o.value('restart_iface', _('Restart Interface')); + o.value('run_script', _('Run Script')); + + o = s.taboption('general', form.Value, 'script', + _('Script to run'), + _(`Script to run when the host has not responded for the specified duration of time. The script is passed the interface name as $1`)); + o.datatype = 'file'; + o.default = "/etc/watchcat.user.sh"; + o.depends({ mode: "run_script" }); o = s.taboption('general', form.Value, 'period', _('Period'), _("In Periodic Reboot mode, it defines how often to reboot.
\ In Ping Reboot mode, it defines the longest period of \ time without a reply from the Host To Check before a reboot is engaged.
\ - In Network Restart mode, it defines the longest period of \ - time without a reply from the Host to Check before the interface is restarted. \ + In Network Restart or Run Script mode, it defines the longest period of \ + time without a reply from the Host to Check before the interface is restarted or the script is run. \

The default unit is seconds, without a suffix, but you can use the \ suffix m for minutes, h for hours or d \ for days.

Examples: