Making Sure the System Time is Set Correctly Before Imaging
Novell Cool Solutions: Tip
By Pete Demers
Digg This -
Posted: 8 Nov 2006
ENVIRONMENT: ZENworks 7 boot environment
rdate-1.3-2.i386.rpm - http://rpmfind.net/linux/rpm2html/search.php?query=rdate
(Note: We use this version of rdate as newest version was not supported in the ZEN boot environment and generated errors)
Scripted ZENworks Image object
If your image has WGA installed (and it likely does if you used Windows Update to apply all the patches before creating the image) then it is possible that you will experience the issue we had with our Microsoft Volume License Key (VLK).
After loading some PCs with our standard image we were presented with a message that our VLK was not genuine windows software.
After some investigation (and a call to Microsoft) we found that some systems were experiencing this issue because of a server issue at Microsoft. (See article http://support.microsoft.com/kb/926333)
While this addressed some issues, we found that others were the result of incorrect system time, some clocks were off as little as two months and others as much as five years. To ensure that the system time is set correctly on the PCs prior to imaging we came up with the following method of getting the time from a time server and using that time to set the hardware clock.
Adding rdate to our /bin directory we are able to call the system time from a time server (We have a time server in house, but there are many public time servers on the internet. (See http://ntp.isc.org/bin/view/Servers/WebHome).
rdate is used to set the system time (OS) to the current UTC time. The ZEN Boot environment is set at UTC and we will need to adjust the time to a current timezone. In our case that is Eastern Standard Time. EST is UTC -4 hours.
Using a variable (UTCOFFSET) in our script we set the UTC offset (We use ZEN Imaging all over the world and need to be able to modify the script for local time easily.)
The variable is used later in the script by the date command to adjust the time and finally the command hwclock is used to set the hardware clock using the system time.
While this solution doesn't account for Daylight Savings Time, it really isn't necessary as the Novell client is use to finally set the clock at login to the proper time. Of course if someone is clever enough (and has time on their hands) to write a bash script to account for DST, let me know!
#Number of hours offset from UTC UTCOFFSET=-4 echo Retrieving current time from time server.... rdate -s <YOUR TIME SERVER> echo Setting clock using UTC offset #Store the offset UTC time to a var MOD_TIME=`date --date="$UTCOFFSET hours"` #Use the var to set the system time date -s $MOD_TIME echo Synchronizing hardware clock using system time hwclock --systohc
If you have any questions you may contact Pete at pete.demers@TAKETHISOUTfairchildsemi.com
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com