Sync Solaris System Clock With PDC Using Cron

Hi,

I currently use the ntpdate and date command to sync the internal clock source of my Solaris systems to the primary domain controller.

 
admin@myserver # ntpdate -d -u 192.168.???.???
14 Jan 17:42:02 ntpdate[929]: ntpdate 3-5.93e+sun 03/06/05 23:16:45 (1.4)
transmit(192.168.???.???)
receive(192.168.???.???)
transmit(192.168.???.???)
receive(192.168.???.???)
transmit(192.168.???.???)
receive(192.168.???.???)
transmit(192.168.???.???)
receive(192.168.???.???)
transmit(192.168.43.1)
server 192.168.???.???, port 123
stratum 1, precision -6, leap 00, trust 000
refid [LOCL], delay 0.04144, dispersion 0.00035
transmitted 4, in filter 4
reference time:    cef8b7b1.ac10624d  Thu, Jan 14 2010  7:20:49.672
originate timestamp: cef9493b.f4000000  Thu, Jan 14 2010 17:41:47.953
transmit timestamp:  cef9494a.90dee000  Thu, Jan 14 2010 17:42:02.565
filter delay:  0.04189  0.04146  0.04144  0.04146
                   0.00000  0.00000  0.00000  0.00000
filter offset: -14.6115 -14.6121 -14.6125 -14.6128
                   0.000000 0.000000 0.000000 0.000000
delay 0.04144, dispersion 0.00035
offset -14.612542
14 Jan 17:42:02 ntpdate[929]: step time server 192.168.???.??? offset -14.612542 sec

I then take the output of the offset and use the following to slowly sync

date -a -14.612542

Is it possible to run a .sh executable script that would combine both commands and take the offset value of the ntpdate command and automatically insert the value into the date -a command. I would then like to run in a cron.

Thanks in advance

Run the ntpdate command and grep for offset and store it in a variable and then pass on the value of variable to date command

DATE=`ntpdate -d -u 192.168.???.??? | grep offset`
date -a $DATE

Why not just install an NTP daemon that will continuously synch your clock?