#!/bin/bash


. /ips/setup/.config

if [ "$1" = "--force" ]; then
   NTP_DAILY=
fi

if [ "$NTP_DAILY" = "1" ]; then

   DAT=`date +"%Y.%m.%d"`

   NTP=`cat /ips/tmp/NTP 2> /dev/null`
   if [  "$NTP" = "$DAT"   ];  then
      echo $DAT already synchronized
      exit 0
   fi

   echo $DAT synchronizing
   echo $DAT > /ips/tmp/NTP
  
fi

if [ "$NTP_SERVER" != "" ]; then
  
   ntpdate "$NTP_SERVER"

else

   ntpdate vega.cbk.poznan.pl

fi

