Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!ll-xn!ames!pasteur!ucbvax!NMFECC.ARPA!KARCHER%MIT.MFENET From: KARCHER%MIT.MFENET@NMFECC.ARPA Newsgroups: comp.os.vms Subject: RE: Managing cluster(s) of Vaxstations Message-ID: <880405165401.2060021c@NMFECC.ARPA> Date: 5 Apr 88 23:54:01 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 55 In response to John Macallister's query on Managing a LAVC of remote Vaxstations: Managing a LAVC of remote vaxstations does have it's momements when you can't get to a particular machine. While SHUTDOWN won't run in Batch mode it will run from a detached job. We've used a procedure that executes on a batch queue of the node to be rebooted and runs LOGINOUT to create a detatched job that in turn runs SHUTDOWN. Of course if the reboot fails for some reason your sunk. The procedure we use (35 lines) follows: ---------------------------------------------------------------------------- $! FILE: REBOOT.COM VERSION 1.0 EDIT: 880317 - CAK ORIG: TWF $! DCL procedure to run shutdown to reboot LAVC nodes. It assumes batch queues $! in the LAVC have names of format "node$BATCH". Change the SUBMIT line for $! other conventions. The shutdown is done immediately $ $ THIS_FILE = F$ENV("PROCEDURE") ! Get the name of this file $ NODE := 'F$GETSYI("SCSNODE")' $ IF F$MODE() .EQS. "BATCH" THEN GOTO BATCH ! If BATCH mode dispatch to commands $ IF F$ENV("DEPTH") .EQ. 0 THEN GOTO DETACHED ! If Detached dispatch to commands $ $! At this point we're Not Batch or Detached, assume it's interactive. $ $ IF P1 .EQS. "" THEN INQUIRE P1 "Node to reboot [''NODE']" $ IF P1 .EQS. "" THEN P1 = NODE $ SUBMIT/NOPRINT/NOLOG/USER=SYSTEM/QUE='P1'$BATCH 'THIS_FILE' ! Submit this file on proper queue $ EXIT $ $! The following section runs in batch mode on the node we want to shutdown. $! It creates a detached process that takes it's input from this the DETACHED $! section of this file to run the actual shutdown procedure. This is required $! since the SHUTDOWN procedure will only run in interative mode. $BATCH: $ LOG_FILE = F$PARSE (".LOG",THIS_FILE) ! Build log filename from this file $ RUN/DETACH/INPUT='THIS_FILE' /OUTPUT='LOG_FILE' SYS$SYSTEM:LOGINOUT ! Create a process to run SHUTDOWN $ EXIT $ $! The following section supplies DCL commands to the process we created above $! using LOGINOUT and runs the SHUTDOWN procedure on the node to be shutdown. $DETACHED: $ VERIFY = F$VERIFY(0) ! Turn off verification $ WRITE SYS$OUTPUT "%REBOOT-I-STARTED, Detached job started on node ''NODE' at ''F$TIME()'" $ REPLY/NODE='NODE'/USER/BELL "%REBOOT-I-STARTED, System shutdown procedure started ..." $ DEFINE SHUTDOWN$INFORM_NODES 'NODE' ! Only bother this node $ @SYS$SYSTEM:SHUTDOWN 0 REBOOT NO YES SHORTLY YES REBOOT_CHECK ! Execute SHUTDOWN to reboot this node ------------------------------------------------------------------------------ END OF PROCEDURE C. A. Karcher MIT Plasma Fusion Center KARCHER%PFCVAX@MIT-XX.LCS.MIT.EDU.ARPA KARCHER%MIT.MFENET@NMFECC.ARPA KARCHER%MIT.MFENET@ANLVMS.BITNET