Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 10 lines (7 sloc) 0.331 kb
219d036 @falconindy A hillariously simple internet time server script to be cron jobbed.
authored
1 #!/bin/bash
2
e95f885 @falconindy simplentp: fix error in logic
authored
3 (( UID == 0 )) || { echo "Error: Must be root!"; exit 1; }>&2
5aa4c92 @falconindy Use fast fail logic instead of putting the execution in an else clause
authored
4
ba66a4a @falconindy simplentp: cleanup
authored
5 printf "Setting hwclock to localtime from time.nist.gov...\n"
6 hwclock --set --date="$(awk 'NF > 1 {print $2,$3,"UTC"}' < /dev/tcp/time.nist.gov/13)" || exit 1
7 printf "Sync'ing hwclock to system...\n"
8 hwclock -s
bfa4940 @falconindy add trailing newline
authored
9 printf "The time is now: %s\n" "$(hwclock)"
Something went wrong with that request. Please try again.