#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
upgrade_watchcat() {
|
|
local cfg="$1"
|
|
|
|
config_get period "$cfg" period
|
|
config_get mode "$cfg" mode
|
|
config_get pinghosts "$cfg" pinghosts
|
|
config_get forcedelay "$cfg" forcedelay
|
|
|
|
[ -f "/etc/config/watchcat" ] || touch /etc/config/watchcat
|
|
uci_add watchcat watchcat
|
|
uci_set watchcat @watchcat[-1] period "$period"
|
|
uci_set watchcat @watchcat[-1] mode "$mode"
|
|
uci_set watchcat @watchcat[-1] pinghosts "$pinghosts"
|
|
uci_set watchcat @watchcat[-1] forcedelay "$forcedelay"
|
|
|
|
uci_remove system "$cfg"
|
|
}
|
|
|
|
config_load system
|
|
config_foreach upgrade_watchcat watchcat
|
|
|
|
uci_commit watchcat
|
|
uci commit system
|