Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


versalogic_vl-mpeu-g2_ntp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
versalogic_vl-mpeu-g2_ntp [2014/06/21 21:11]
admin [Configure, firmware update ublox NEO-7 module]
versalogic_vl-mpeu-g2_ntp [2015/01/24 18:40] (current)
admin [Leap second file]
Line 136: Line 136:
  
   * Install lftp. <​code>​apt-get install lftp</​code>​   * Install lftp. <​code>​apt-get install lftp</​code>​
-  * Create leap second download script ​**/​usr/​local/​bin/​get_leap.sh** <​code>#​!/​bin/​bash +  * Create leap second download script ​[[get_leap_script|/​usr/​local/​bin/​get_leap.sh]]
- +
-# This script will download the latest leap second file, +
-# update the NTP configuration and restart ntpd. +
- +
-# Leap second file location +
-#​leapremote="​ftp://​time.nist.gov/​pub/"​ +
-leapremote="​ftp://​tycho.usno.navy.mil/​pub/​ntp/"​ +
- +
-# Local file name +
-leaplocaldir="/​var/​lib/​ntp/"​ +
-leaplocalfile="​$leaplocaldir/​leap-seconds"​ +
- +
-# Get latest leap second file +
-/​usr/​bin/​lftp -e 'set net:timeout 10 ; cls -1 --sort=date | head -1 > /tmp/leap ; exit' $leapremote +
-if [ $? -ne 0 ]; then +
-  echo "FTP problem, exiting."​ +
-  exit 1 +
-fi +
- +
-if [ -f "​$leaplocaldir$(cat /​tmp/​leap)" ​]; then +
-  echo "File $leaplocaldir$(cat /tmp/leap) already exists. Not downloading."​ +
-else +
-  cd "​$leaplocaldir"​ +
-  /​usr/​bin/​lftp -e "set net:timeout 10 ; get $(cat /tmp/leap) ; exit" $leapremote +
-  ln -sfn "​$leaplocaldir$(cat /​tmp/​leap)"​ "​$leaplocalfile"​ +
-  service ntp restart +
-fi</​code>​ +
-  * Change executable mode <​code>​chmod +x /​usr/​local/​bin/​get_leap.sh</​code>​ +
-  * Download new file weekly. Create **/​etc/​cron.weekly/​leapsecond** <​code>#​!/​bin/​bash +
- +
-/​usr/​local/​bin/​get_leap.sh</​code>​+
   * Change executable mode <​code>​chmod +x /​etc/​cron.weekly/​leapsecond</​code>​   * Change executable mode <​code>​chmod +x /​etc/​cron.weekly/​leapsecond</​code>​
 ====Configure,​ firmware update ublox NEO-7 module==== ====Configure,​ firmware update ublox NEO-7 module====
versalogic_vl-mpeu-g2_ntp.txt · Last modified: 2015/01/24 18:40 by admin