Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

unable to shutdown with a batch job

 
SOLVED
Go to solution
Joe Gibbens
Occasional Contributor

unable to shutdown with a batch job

I'm trying to set up a system for periodic shutdowns. A DCL procedure using sysman works interactively but fails when submitted to a batch queue. Is this because shutdown is shutting down the queue? Guessing that this is a queue shutdown problem, I tried to run a detached process to kickoff the shutdown procedure. The sysman shutdown is submitted but it terminates without shutting the system down. Here's what I have...

$ type mydetached.com
$ set verify
$ run sys$system:loginout.exe /detatched /input=sys$manager:myshutdown.com -
/output=opa0:
$ type myshutdown.com
$ set proc/priv=all
$ set verify
$ run sys$system:sysman
show environment
shutdown node/minutes=0 /reason="test shutdown"

Here's the output..

$ @mydetached
$ set verify
$ run sys$system:loginout.exe /detatched /input=sys$manager:myshutdown.com -
/output=opa0:
%RUN-S-PROC_ID, identification of created process is 00000247

Console output...


Monday
October 25, 2010
10:47:03

$ run sys$system:sysman
show environment
%SYSMAN-I-ENV, current command environment:
Local node only
shutdown node/minutes=0 /reason="test shutdown"
%SYSMAN-I-SHUTDOWN, SHUTDOWN request sent to node ADAS21
SYSTEM job terminated at 25-OCT-2010 10:47:04.26
7 REPLIES 7
abrsvc
Respected Contributor

Re: unable to shutdown with a batch job

You must redirect the input stream to the command file for the "myshutdown" procedure. Running as a detached propgram should use the file as sys$input, but I have run into this before. Try that first.

Dan
Joe Gibbens
Occasional Contributor

Re: unable to shutdown with a batch job

I'm sorry, I don't understand what I need to change. Can you tell me how you would re-write this?
John Gillings
Honored Contributor

Re: unable to shutdown with a batch job

Joe,

I'm not sure what abrsvc means either. From your log file the shutdown request has certainly been sent - I don't know why it didn't act.

I'd suggest you send the log to a file, rather than OPA0:, and perhaps put a WAIT at the end to make sure stopping the process doesn't somehow block the shutdown.

I seem to recall a new feature specifically intended to allow a shutdown from BATCH, I thought it was the SYSMAN SHUTDOWN command!

Another option is to run SHUTDOWN.COM itself detached, or at least run your own procedure which invokes SHUTDOWN with appropriate parameters (see default SYSTEM LOGIN.COM for symbol definitions).

If all else fails, I've got some programs which will crash a system on demand, including some logic to synchronize crashing a number of cluster nodes simultaneously - we use it to simulate site failures.
A crucible of informative mistakes
John Gillings
Honored Contributor

Re: unable to shutdown with a batch job

Joe,
something else to try:

SYSMAN> SHUTDOWN NODE/MINUTES=1

maybe the SHUTDOWN/MINUTES=0 is done in the context of the current process? If you put in a delay, SYSMAN must fire up a detached process to do it for you.

(sorry, this isn't something I'm going to test for you... ;-)
A crucible of informative mistakes
Colin Butcher
Esteemed Contributor
Solution

Re: unable to shutdown with a batch job

Doesn't your MYSHUTDOWN.COM need to wait until the shutdown completes after issuing the shutdown request, rather than exiting immediately?

To avoid having to create another command file for input to SYSMAN consisting of multiple lines, issue the SYSMAN SHUTDOWN command as a single line command.

Try this (and no, I've not tested it for you):

MYSHUTDOWN.COM

$ set noon
$ set proc/priv=all
$ set verify
$ shutdown0 := "mcr sysman shutdown node /min=0/noauto"
$ shutdown0
$ wait 00:10:00
$ exit

Of course, the final exit should never happen.

Cheers, Colin (http://www.xdelta.co.uk).
Entia non sunt multiplicanda praeter necessitatem (Occam's razor).
Kjell Carlsson
Frequent Advisor

Re: unable to shutdown with a batch job

This is a script I am using to restart from a detached process. Can bi initiated from batch or interactive. For shutdown just change that parameter to NO.


$
$! Script BATCHREBOOT.COM performs a system reboot from a detached process.
$! Not depending of the communication with the user.
$
$
$ if f$getjpi("", "mode") .eqs. "OTHER" then goto DETA
$
$ run sys$system:loginout/deta/proc=prov/uic=[system] -
/output=sys$manager:batchreboot.out-
/error=sys$manager:batchreboot.err-
/input=sys$manager:batchreboot.com
$ exit
$
$
$ DETA:
$ set veri
$ @sys$system:shutdown 0 Omstart yes no later yes none
Y
$

Kjell
Joe Gibbens
Occasional Contributor

Re: unable to shutdown with a batch job

Adding the wait statement to myshutdown.com worked. The detached process must have needed the input file to remain open to keep it from terminating before the shutdown could complete. Thanks for all the help! :)