Many Problems From One Question
I suggest you play around with this. There are lots of pieces to your solution and perhaps a simple answer. Why not enter
sudo date mmddhhmm
when you log in?
As to saving your last good date in a form that could be used by the date command later on here are some examples of saving and using the saved value to set the date.
#!/bin/bash
echo `date +"%m%d%H%M"` > last_good_date
As to setting your date string back
#!/bin/bash
exec 3< last_good_date
while read LINE <&3; do
date_str=$LINE
done
date $date_str
These represent two different shell scripts, which when saved, need to have execute permissions chomd +x <file_name>
As to whether the network is up, you could test the output of running ntp, and if is non 0, then you'd set the date.
Last edited by cmnorton; 03-27-2008 at 11:52 AM.
Reason: Add more stuff
|