#!/bin/sh # ------- # File: llxcfg-ntpdate # Description: configure local chrony to be a client of current CAP_MASTER # Authors: Luis Antonio Garcia Gisbert # -------- # do some tests [ "$CAP_HOST_ID" -a "$CAP_MASTER_ID" -a "$CAP_HOST_ID" != "$CAP_MASTER_ID" ] || exit 0 [ "$CAP_NET_MASK" -a "$CAP_NET_ADDRESS" ] || exit 0 [ "$CAP_NET_CAPNAME" -a "$CAPNAME" -a "$CAP_NET_CAPNAME" = "$CAPNAME" ] || exit 0 # OK, do the required job NTP_SERVER_IP="${CAP_NET_ADDRESS%.*}.${CAP_MASTER_ID}" NTP_MINPOLL=6 echo "Updating cronyd configuration" ntpdate $NTP_SERVER_IP || true llxcfg-ntp-cli -f - << EOF offline $CAP_NET_MASK/$CAP_NET_ADDRESS add server $NTP_SERVER_IP minpoll $NTP_MINPOLL online 255.255.255.255/$NTP_SERVER_IP makestep EOF exit 0