Skip to Content.
Sympa Menu

baslinux - [BL] help on understanding script

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: James Miller <jamtat AT mailsnare.net>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] help on understanding script
  • Date: Thu, 15 May 2003 14:31:16 -0500 (CDT)

I asked earlier onlist about time-syncing programs for BL and netdate was
one of the suggestions. I've gotten it installed, and am looking at ways
of automating the time sync (bad CMOS battery, so time can get pretty far
off while the computer is powered down). One article I found even gives a
script for automating netdate's time-sync, as follows:

Otherwise, here is a simple script to do the trick:

# cat /sbin/timehosts

#!/bin/sh

#now to set the system date to the most reliable time server
netdate 129.6.15.28 132.163.4.102 131.107.1.10 207.200.81.113

# see http://www.bldrdoc.gov/timefreq/service/time-servers.html

#now to set the CMOS/hardware clock
clock -w
#or if clock not available try
#hwclock --systohc

I've written a simple script or two in the past, so I understand the
#!/bin/sh part and what follows. But I don't understand the previous line
- the # cat /sbin/timehosts part. Could someone help by clueing me in on
what this is supposed to do? It seems that it's not suupsed to be part of
the script, but something issued from the command line prior to writing
the script. But what does it do?

Same question holds for the following script, which is supposed to
autoupdate the date in CMOS:

Don't forget to chmod 755 /sbin/timehosts to allow it to be written to
by root and executed by all.

Or for a bit more information:

# cat /sbin/setdate

#!/bin/sh
#lets see what the current system date is
echo The current System date and time is
date
echo the CMOS/Hardware clock date/time is
clock -r
#or if clock is not available
#hwclock --show

#now to set the system date to the most reliable time server
netdate 129.6.15.28 132.163.4.102 131.107.1.10 207.200.81.113
#has the system time changed much?
echo The Sytem and CMOS/Hardware clock date/time will be set to:
date
#now to set the CMOS/hardware clock
clock -w
#or if clock not available try
#hwclock --systohc

#for finding other IPs to use for netdate see the below
# see http://www.bldrdoc.gov/timefreq/service/time-servers.html

Don't forget to chmod 755 /sbin/setdate to allow it to be written to
by root and executed by all.

Help on understanding this will be appreciated. The scripts may also be
of interest to other BL2 users who want to time-sync their machines.

James




Archive powered by MHonArc 2.6.24.

Top of Page