Re: offtopic - unix command

2002-05-16 Thread Steven Lembark


 Is there a way to check for the success/failure of the actual remote
 command when using rsh?

$a=$(rsh blah);

and parse $a for output for an indication of the blah
command succeeding or failing.

--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Lembark
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: offtopic - unix command

2002-05-16 Thread Kevin Lange

I do it all the time with a line like this :

  rsh $1 . ${vTARGETPROFILE};mkdir $2;echo \$?

In this case, I am making a directory called $2 at host $1.  The unix
command sets the error value so when you can now get that value over on the
calling machine.

You could also do it like this:

rsh ${vTARGETHOST} . ${vTARGETPROFILE};echo \${ORACLE_BASE | read
vTARGETORABASE

In this case, I am getting the value of ORACLE_BASE at the remote host
vTARGETHOST and reading it into the variable vTARGETORABASE.

-Original Message-
Sent: Thursday, May 16, 2002 12:16 PM
To: Multiple recipients of list ORACLE-L


But what if command blah does not output anything? In this
case, $a is null, as it is when the command fails.

Steven Lembark wrote:

 Is there a way to check for the success/failure of the actual remote
 command when using rsh?

$a=$(rsh blah);

and parse $a for output for an indication of the blah
command succeeding or failing.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Bill Becker
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Kevin Lange
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: offtopic - unix command

2002-05-16 Thread Steven Lembark



-- Bill Becker [EMAIL PROTECTED]

 But what if command blah does not output anything? In this
 case, $a is null, as it is when the command fails.

Either:

Look for a success message and change the sense of the test.

Run the remote command in verbose mode.

Wrap the remote command in something that does output a
reasonable message (or re-write it to do so if you have
any control).

If the command has neither verbose mode nor any useful
messages by default then give its programmer 30 lashes
w/ a wet noodle for designing undecipherable code.

--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Lembark
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: offtopic - unix command

2002-05-16 Thread Brian_P_MacLean


Haven't used rsh in many many moons (ssh is the correct way these daze),
and I have no way to test this but maybe it will work.

RTN=$(rsh otherbox mycmd parm1 parm2 ; [ ${?} -eq 0 ]  echo OKAY || echo
FAILED)
if echo ${RTN} | grep OKAY 1/dev/null 21
then
  echo GOOD
else
  echo BAD
fi

Another option for the first line might be:

RTN=$(rsh otherbox if mycmd parm1 parm2
then
  echo OKAY
else
  echo FAILED
fi
)

And even another option for the first line is:

RTN=$(rsh otherbox [ mycmd parm1 parm2 ]  echo OKAY || echo FAILED)


If you give my the ip address, the username, and add + to your .rhosts
file I would be happy to try it out...lol

Brian P. MacLean
Oracle DBA, OCP8i



   

  Bill Becker  

  beckerb@mfldclinTo:   Multiple recipients of list 
ORACLE-L [EMAIL PROTECTED]   
  .educc: 

  Sent by: Subject:  offtopic - unix command   

  [EMAIL PROTECTED] 

   

   

  05/16/02 10:15 AM

  Please respond to

  ORACLE-L 

   

   





But what if command blah does not output anything? In this
case, $a is null, as it is when the command fails.

Steven Lembark wrote:

 Is there a way to check for the success/failure of the actual remote
 command when using rsh?

$a=$(rsh blah);

and parse $a for output for an indication of the blah
command succeeding or failing.

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Bill Becker
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).





-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: offtopic - unix command

2002-05-16 Thread Steven Lembark



-- [EMAIL PROTECTED]


 Haven't used rsh in many many moons (ssh is the correct way these daze),
 and I have no way to test this but maybe it will work.

 RTN=$(rsh otherbox mycmd parm1 parm2 ; [ ${?} -eq 0 ]  echo OKAY ||
 echo FAILED)
 if echo ${RTN} | grep OKAY 1/dev/null 21
 then
   echo GOOD
 else
   echo BAD
 fi

 Another option for the first line might be:

 RTN=$(rsh otherbox if mycmd parm1 parm2
 then
   echo OKAY
 else
   echo FAILED
 fi
 )

 And even another option for the first line is:

 RTN=$(rsh otherbox [ mycmd parm1 parm2 ]  echo OKAY || echo FAILED)

These will work but depend on shell-specific syntax. Using
a #! file on the remote end is a bit safer and allows for
comments in the code.

--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Lembark
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).