1
0
This repository has been archived on 2025-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Anderson Luiz Alves 0464e230c1 stock 103961
2017-07-30 16:48:04 -03:00

44 lines
832 B
Bash
Executable File

#!/bin/sh
# Called on ip-up-lan event on a LAN interface
# $LANID, LAN interface index
restart_ntp() {
# Sanity check on NTP command
local ntpcmd=/var/bewan/ntp.d/ntp.sh
[ ! -f $ntpcmd ] && return
# Sanity check on interface type
if [ "${Services_Time_NTPInterfaceType:-}" != "LANDevice" ]; then
return
fi
# Sanity check on interface
local lanid=${LANID:-}
if [ "$lanid" = '' ]; then
return
fi
# Specific wan interface ?
local iface=`cat /var/bewan/ntp.d/interface 2>/dev/null`
if [ "$iface" = '' ]; then
return
else
# Use specific interface
local found=0
local i
for i in `strip $iface`; do
if [ "$i" = "$lanid" ]; then
found=1
fi
done
if [ "$found" = 0 ]; then
return
fi
fi
# Execute NTP request in background
start-stop-daemon -S -b -x $ntpcmd -- lan $lanid
}
restart_ntp