Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-11-05T18:13:15Z by RDzDoug
SergioDataAdviser
SergioDataAdviser
5 Posts
ACCEPTED ANSWER

Pinned topic RD&T automatic shutdown

‏2013-11-05T09:11:45Z |

Hi,

I am trying to develop a Linux script to stop automatically RD&T, for that, the best way to do that is using the command oprmsg and launching my "S SHUTDOWN" z  procedure, stopping correctly this way my z system.

I am working on Red Hat 6 and RD&T 8.5

But I need capture the output of this command oprmsg to be sure that the system is correctly stopped before execute awsstop, and I have to problems:

1) When I execute oprmsg with a command, for example:

       oprmsg 'D A,L'    the result is showed in screen sucessfully, but!, the command is waiting for an user response (one Enter for example).

       Do you now if there are any way to execute the command oprmsg without user response?

 

2) When I try to redirect the oprmsg output to a file using for example:

       oprmsg 'D A,L' > output.log

    It is not working. Do you know how can I redirect this output to a file?.

 

Thank you in advance to everybody and regards.

 

 

  • RDzDoug
    RDzDoug
    5 Posts
    ACCEPTED ANSWER

    Re: RD&T automatic shutdown

    ‏2013-11-05T18:13:15Z  in response to SergioDataAdviser

    The console output goes to a file in ~/z1090/logs.  Although it is a little ugly, especially on an active system, you can grab the output from there.  I think you could get the outstanding replies with D R,L and you'd have to parse it.  Here is an example that does a D A,L and saves the output to a separate file.  It finds the most recent console file and also uses tac which reverses the file and may not be standard (it is on my SUSE system).  There may be much better ways to do these tasks but you'll get the idea.

    #!/bin/sh
    oprmsg "V CN(*),ACTIVATE"  # turn on console cmds
    sleep 1                    # let output go to console
    oprmsg "D A,L"             # display active list
    sleep 1                    # let output go to console
    # search console for  last command and all output since.
    tail -n 200  `ls -t ~/z1090/logs/*con* | head -n 1` \
            |tac |sed -n '1,/^CMD/'p |tac \
             >  consout.txt
    cat consout.txt
    # use grep or other commands here
    rm consout.txt
     

    Updated on 2013-11-05T18:20:43Z at 2013-11-05T18:20:43Z by RDzDoug