working vendor record plus new system time update
[feisty_meow.git] / scripts / system / update_system_time.sh
1 #!/bin/bash
2 #
3 # a simple time update script that traps output from rdate, since we
4 # get a lot of noise even when a successful update occurs, to whit:
5 #  "rdate: Could not read data: Success"
6 #
7 # author: chris koeritz
8
9 #hmmm: the generalized pattern of show output only on error is embodied below.  make it a function.
10
11 outfile="$(mktemp /tmp/update_system_time.XXXXXX)"
12 /usr/bin/rdate -s time.nist.gov &> "$outfile"
13 retval=$?
14 if [ $retval -ne 0 ]; then
15   echo "Actual error code $retval returned by rdate, with output:"
16   cat "$outfile" 
17 fi
18 rm -f "$outfile"
19