[comp.sys.sun] How do you get a remote Sun to reboot itself

trw@hrc63.co.uk (Trevor Wright) (05/30/89)

The Scenario: a Sun-3/280 server with an Exabyte video tape unit aboard
acts as the central backup machine for 25+ Suns. It runs a program which
automates the backup for level 5,3 and 0's. For 3's and 5's no reboot of
the remote systems are necessary, but for a 0 Sun recommend you reboot the
system.

The problem is that in order to do this from the central system you need to
issue a "rsh <machine name> /etc/reboot" or similar.

The Question: How do you sensibly reboot the far machine so that you do
not hang yourself until it is rebooted, and do not generate vast numbers
of processes (which eventually overflow the max number allowed)

I'm interested in replies from those who have a solution (tried and
tested) and not just well intentioned suggestions "which should work" as
we've tried all of those ourselves. Sun UK dont know and referred back to
the US who I guess have not replied to the UK yet.

Trevor Wright/GEC-Marconi Research/Chelmsford UK
yc23%a.gec-mrc.co.uk@nfs-relay.ac.uk (formerly nss.cs.ucl.ac.uk)

maart@uunet.uu.net (Maarten Litmaath) (06/15/89)

trw@hrc63.co.uk (Trevor Wright) writes:
\...
\The problem is that in order to do this from the central system you need to
\issue a "rsh <machine name> /etc/reboot" or similar.

\The Question: How do you sensibly reboot the far machine so that you do
\not hang yourself until it is rebooted, and do not generate vast numbers
\of processes (which eventually overflow the max number allowed)

Using csh on the remote machine:

    rsh machine -n '(sleep 30; /etc/reboot) >& /dev/null < /dev/null &'

Using sh:

    rsh machine -n '(sleep 30; /etc/reboot) > /dev/null 2>&1 < /dev/null &'

Explanation:

1)	`-n' attaches rsh's stdin to /dev/null, so you can run it in the
	background
2)	the `sleep 30' is there to be sure the rsh session has been
	terminated before the reboot starts
3)	the input/output redirections make sure rsh thinks the session can
	be terminated (there's no data flow anymore)

Various parts of these complicated commands could be left out; however, now
we're sure all rsh `nasties' have been dealt with.
-- 
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
   they're small."  (Stephen Savitzky)    |maart@cs.vu.nl, mcvax!botter!maart

pease@immigrant (Roger Pease) (06/15/89)

Not so tough.  The technique I've seem used involves a recursive script
installed on the machine you with to halt.  This script checks to see if
it was envoked with a particular arbitrary option ( -xyzzy, maybe).  If it
was not invoked with the "magic option", it would re-envoke itself
(generating a sub-shell) in the background and with the "magic option".

The second invocation (in the backgound) having seen the "magic option"
set, would sleep for 15 seconds or so, then invoke /etc/reboot.  Got that?
Maybe it's not so simple after all...  But it really does work.

This idea comes from a Software Technical Bulletin published by Sun.  If
you can't figure it out from the above (I wouldn't blame you.), I'll dig
the real thing up.

Hope this helps...

	Roger Pease