Fix for system BOOT date&time, all SysV systems

Thad P Floryan thad at cup.portal.com
Fri Dec 29 19:00:12 AEST 1989


Fix for system BOOT date & time, all SysV systems --

In case your SysV system has NOT been showing the correct BOOT date&time
(such as that displayed by `who -r`), or your sysinfo daemon(s) are also off
(such that they show the date&time of the last SHUTDOWN), the fix is simple.

Yeah, I finally read the FM!  :-)   Specifically, the UNIX System V Release
3.2 System Administrator's Guide and the Reference Manual.

In the absence of the following "fixes", it "appears" the boot date&time is
derived from the last update date&time on /etc/inittab, even if one's /etc/rc
script has command(s) to set the present date&time.

The solution is simple in retrospect (after eleventy-seven reboots and fixing
some stooopid typos on my part):

1) edit /etc/inittab and insert an entry as "sysinit" to invoke /etc/setclk
2) create an /etc/setclk script to actually set the timezone and date&time.
   Systems without a battery-backed clock may wish to interrogate the console.
3) remove any date&time setting from /etc/rc

Gee, reading inittab(4) is quite interesting.  Actions such as "respawn",
"wait", "once", "boot", "bootwait", "powerfail", "powerwait", "off",
"ondemand", "initdefault" and "sysinit".  And explanations of the pseudo
run-levels "a", "b" and "c".  I should take a vacation more often and read
the other 15 or so volumes of SysV docs.  :-)

Though my system is a 3B1 (aka UNIXPC), this info should benefit all SysV
system administrators/operators.  Enclosed are the relevant files and/or
changes as presently implemented on my test system and also now implemented
on my "production" systems:

1) /etc/inittab  (the "sysinit) entry is added (for the 3B1); its /etc/init
   does everything as documented in the SysV3.2 manual.  Note the "uugetty"
   entries are relevant ONLY if one has HDB BNU; otherwise the entries
   should resemble the item for " vid:2:respawn:/etc/getty ..." for the
   version 2 UUCP software suite.  And note one CAN safely edit the file.
   Any finally note that the /etc/inittab for 3B2 systems may already have
   similar "sysinit" entries; doesn't hurt to check if you're not sure.

	:sccs	"@(#)fndetc:inittab	1.2"
	: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	: DO NOT EDIT THIS FILE!!! IT IS PROGRAM-MODIFIED!!!!!
	:
	: The following states are used :
	:	s = single user
	:	2 = general single or multiple user mode
	: REPEAT:  DO NOT EDIT THIS FILE!!! IT IS PROGRAM-MODIFIED!!!!!
	ck::sysinit:/etc/setclk > /dev/null 2>&1
	is:2:initdefault:
	rc::bootwait:/etc/rc > /dev/null 2>&1
	 vid:2:respawn:/etc/getty window 9600
	:ph0:2:respawn:/usr/lib/uucp/uugetty -r -t60 ph0 1200
	:ph1:2:respawn:/etc/getty ph1 1200
	 000:2:respawn:/usr/lib/uucp/uugetty -r -t60 tty000 9600
	 001:2:respawn:/usr/lib/uucp/uugetty -r -t60 tty001 9600
	 002:2:respawn:/usr/lib/uucp/uugetty -r -t60 tty002 9600

2) /etc/setclk (new script created by me).  Note the "chmod" settings.  One
   could change the { TZ="PST8PDT } to be { TZ=`cat /etc/TZ` }, but all this
   is happening before the initial fsck and I *like* to have my clock set
   correctly even if the disk suffers bit decay and software rot!  :-)
   Uh, the "PST8PDT" is good for the West Coast; change as appropriate for
   your site's location:

	# cd /etc
	# ls -l setclk
	-rwxr-xr-x  1 root    root         30 Dec 28 22:00 setclk
	# cat setclk
	TZ="PST8PDT";export TZ
	date -
	#

3) comment-out any "setclk" or "date -" in the /etc/rc file.  You should
   probably leave in any "TZ=...." stuff because I haven't tested whether
   the setting in /etc/setclk is sufficient; 20 reboots in one day is enough
   for me.  :-)

Thad Floryan [ thad at cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]



More information about the Comp.sys.att mailing list