Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!husc6!bloom-beacon!mit-eddie!killer!texbell!ssbn!bill
From: bill@ssbn.WLK.COM (Bill Kennedy)
Newsgroups: comp.sys.att
Subject: Re: Run levels 5 & 6 (Re: AT&T 386 UNIX reboot)
Summary: Don't try that one...
Message-ID: <263@ssbn.WLK.COM>
Date: 27 Nov 88 23:44:29 GMT
References: <254@ssbn.WLK.COM> <5284@cbmvax.UUCP>
Organization: W.L. Kennedy Jr. & Associates, Pipe Creek, TX
Lines: 53

In article <5284@cbmvax.UUCP>, ditto@cbmvax.UUCP (Michael "Ford" Ditto) writes:
> In article <254@ssbn.WLK.COM> bill@ssbn.WLK.COM (Bill Kennedy) writes:
> >An article I posted earlier asks if anyone knows how to make run levels
> >5 or 6 work with AT&T 386 UNIX.

First thanks to Ford for suggesting someplace else to look.

> Here's what I did:  Append the following to /etc/rc0:
> 
> 	set `who -r`
> 	[ $7 = 5 ] && /etc/uadmin 2 0
> 	[ $7 = 6 ] && /etc/uadmin 2 1

I took some license and made that
set `who -r`
if [ $7 = 6 ]
then
	/etc/uadmin 2 1
else
	/etc/uadmin 2 0
fi

The original last line in /etc/rc0 was

/etc/uadmin 2 0

Which shuts down and halts.  It turns out that if you init 6 then /etc/rc0
never gets executed :-(

> Now, "shutdown -i5" will halt the machine and "shutdown -i6" will reboot it;
> in both cases all filesystems (including root) are unmounted and marked as
> "clean" so that they won't be automatically fsck'd when the system comes up.

But only if you get to /etc/rc0.  It appears that init is the culprit.

> This was actually on an Amiga, not a 386, but I suspect that it would work
> if the command codes to uadmin are the same.

I suspect they are, /usr/include/sys/uadmin.h says that the three commands
A_SHUTDOWN=2, A_REBOOT=1, A_REMOUNT=4 and the functions that go with them
AD_HALT=0, AD_BOOT=1, AD_IBOOT=2 with the difference between the first and
second boot being whether or not you use /unix or prompt for the system name.

> 					-=] Ford [=-

So I'm farther along but still not there.  It appears that I should leave
a clue file to execute.  In other words always init 0 in order to execute
/etc/rc0 and then look at the clue file to see whether I should reboot or
not.  That seems a bit bizarre but I never claimed to be elegant.  Does
anyone have any better suggestions?
-- 
Bill Kennedy  usenet      {killer,att,rutgers,sun!daver,uunet!bigtex}!ssbn!bill
              internet    bill@ssbn.WLK.COM