2015-10-16

[SOLVED]Get-Current-Time-Nano-Seconds

#11:05 17/07/2015
now="$(date +'%Y.%m.%d-%H.%M.%S.%6N')"
echo $now
#echo "DRBD1: "$(date +'%Y.%m.%d-%H.%M.%S.%6N')>>/mnt/storage/date.log


######################
root@drbd1:/opt/script# cat get-date-1min.sh
#/opt/script/schedule-per-1min
i=0
while [ $i -lt 60 ]; do
  /opt/script/get-date-1s.sh &
  sleep 1
  i=$(( i + 1 ))
done
####



######################
root@drbd1:/opt/script# cat /opt/script/get-date-1s.sh
echo "DRBD1: "$(date +'%Y.%m.%d-%H.%M.%S.%6N')>>/opt/script/get-date.log


######################
#crontab -e
#Sync Time Server, daily, every 5 mins:
*/5 * * * * /opt/script/time-force-update.sh

#Getdate every 1 min:
* * * * * /opt/script/get-date-1min.sh

######################
#/opt/script/time-force-update.sh
ntpdate -s time.nist.gov
cat /dev/null >/opt/script/get-date.log

No comments:

Post a Comment