On Tue, 02 Jan 2001 20:05:36 John Aldrich wrote:
>A good util is "rdate" to sync your pc clock with an atomic
>clock over the 'Net. 

The only problem with rdate for non-realtime apps is that you have to jump
through hoops to see if it failed. It _always_ gives an exit code of zero,
no matter what errors occur.

One workaround I saw was to redirect STDERR to a file and check for a
non-zero length file:

#!/bin/sh
#
# Specify the location/name of the temp file that will hold
# rdate's error messages (STDERR).
errorfile=/tmp/settime.$$

# Get the date/time and send any errors to the error file.
rdate time.nist.gov 2> $errorfile

# Put the error message(s) in a variable. If there were
# no errors, the file will still exist, but will be empty.
errmsg=`cat $errorfile`

# Remove the temp file.
rm -f $errorfile

# Check to see if there actually was an error message.
if [ -n "$errmsg" ] ; then
  echo 'rdate failed'
else
  echo 'rdate succeeded'
fi
# end of script


-- 
Anthony E. Greene <[EMAIL PROTECTED]> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to