Rebooting Sys V/386

Thomas Hoberg tmh at prosun.first.gmd.de
Thu Apr 4 04:35:57 AEST 1991


In article <602 at genco.bungi.com>, rad at genco.bungi.com (Bob Daniel) writes:
|> In article <253 at rwing.UUCP> pat at rwing.UUCP (Pat Myrto) writes:
|> >In article <570 at bigfoot.first.gmd.de> tmh at prosun.first.gmd.de (Thomas Hoberg) writes:
|> >>        [ lots of previous thread deleted ... ]
|> >>I don't know
|> >>whether the system call uadmin will in some variation do without the
|> >>"press any key to reboot" prompt on the console or not. I didn't want to try.
|> >
|> >There HAS to be some way to do the reboot without the hang on the
|> >"press any key to reboot" msg: running fsck -b on the root partition
|> >returns the msg SYSTEM WILL REBOOT AUTOMATICALLY, and the reboot
|> >starts without requiring ANY user intervention, no pause for pressing
|> >a key, or anything.  Probably whatever call fsck -b makes is what the
|> >party wants...  perhaps some variant of the uadmin(2) call?
|> >-- 
|> 
|> For AT&T SysV 3.2.3, a simple:
|> shutdown -y -g0 -i6
|> will reboot the system.  'g' being the grace period before shutdown starts.
|> 
|> If you want to do it remotely or on another terminal, copy /etc/shutdown
|> to say /etc/shutdown2, strip out the portion that checks that you are
|> on /dev/console.  Then do
|> shutdown2 -y -g0 -i6
|> 
|> This gives you shutdown with reboot on any port (as long as you are 'su').
Well to round this out and get it done with:
If you look at /etc/inittab you should see a line like

"rb:6:wait:/etc/uadmin 2 1 >/dev/console 2>&1 </dev/console"

(At least) two things can be seen from that line:

1. uadmin 2 1 (as opposed to uadmin 2 0, which is used ordinarily in shutdown)
   will reboot without asking to "press any key to reboot"

2. even though the program 'uadmin' (as opposed to the system call uadmin() )
   checks for standard input to come from the console, this is being taken care
   of by the redirection from /dev/console

This is why the solutions promoted by Heiko Blume et.al. and the one given above
work. The check is in the uadmin program so there is no way and indeed no need
to remove the check (other than rewriting uadmin) and 'shutdown2' is unneccessary.

Two more notes: Even though it turns out to be unneccessary, it would be possible
to write a user level program to reboot the computer remotely without harm. One
of the few design principles that went into UNIX and that hasn't been muddied yet,
is that any user level programm can anything that any other can. "All UNIX 
processes were created equal" or there is nothing that only dedicated processes
can do (well almost, there is always process 0). 'umount()' is available to 
unmount file systems and kill(15, -1) resp. kill(9, -1) for diehards, can be used
to get rid of all other processes. uadmin(2, 0) would then do the reboot...

"why do it simple, when you could have so much fun programming (and debugging)
 it?"

-- tom 
----
Thomas M. Hoberg   | UUCP: tmh at bigfoot.first.gmd.de  or  tmh%gmdtub at tub.UUCP
c/o GMD Berlin     |       ...!unido!tub!gmdtub!tmh (Europe) or
D-1000 Berlin 12   |       ...!unido!tub!tmh
Hardenbergplatz 2  |       ...!pyramid!tub!tmh (World)
Germany            | BITNET: tmh%DB0TUI6.BITNET at DB0TUI11 or
+49-30-254 99 160  |         tmh at tub.BITNET



More information about the Comp.unix.sysv386 mailing list