Merge branch 'release-2.140.115'
[feisty_meow.git] / scripts / system / update_system_time.sh
diff --git a/scripts/system/update_system_time.sh b/scripts/system/update_system_time.sh
new file mode 100644 (file)
index 0000000..01efc95
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# a simple time update script that traps output from rdate, since we
+# get a lot of noise even when a successful update occurs, to whit:
+#  "rdate: Could not read data: Success"
+#
+# author: chris koeritz
+
+#hmmm: the generalized pattern of show output only on error is embodied below.  make it a function.
+
+outfile="$(mktemp /tmp/update_system_time.XXXXXX)"
+/usr/bin/rdate -s time.nist.gov &> "$outfile"
+retval=$?
+if [ $retval -ne 0 ]; then
+  echo "Actual error code $retval returned by rdate, with output:"
+  cat "$outfile" 
+fi
+rm -f "$outfile"
+