#!/bin/sh

[ "$IFACE" = "lo" ] && exit 0

# scripts here are not guaranteed to run only once..
LOCK="/tmp/ntp-sync.lock"
[ -e "${LOCK}" ] && exit 0

# if ntpd is not in startup scripts, "Automatic Update" is disabled - do nothing
find /etc/rc5.d | grep "S[0-9][0-9]ntpd$" > /dev/null || exit 0

{
    touch "${LOCK}"

    /etc/init.d/ntpd restart

    rm "${LOCK}"

} &

exit 0
