iopsys-feed/icwmp/files/etc/uci-defaults/95-set-random-inform-time
Vivek Kumar Dutta 6bc1456655
icwmp: 9.5.23
Use default random periodic inform time if not already set
2023-11-29 14:02:20 +05:30

20 lines
381 B
Bash

#!/bin/sh
. /lib/functions.sh
set_inform_time()
{
local sec inform_time value
config_load cwmp
config_get inform_time acs periodic_inform_time '0001-01-01T00:00:00Z'
if [ "${inform_time}" == "0001-01-01T00:00:00Z" ]; then
sec=$(date +%s)
value="$(date -d @$(($sec-$RANDOM)) +%Y-%m-%dT%H:%M:%SZ)"
uci_set cwmp acs periodic_inform_time "$value"
fi
}
set_inform_time