Sponsored Content
Top Forums Shell Programming and Scripting Getting the exit status of a remote command Post 302086396 by zoonalex on Wednesday 23rd of August 2006 04:23:52 PM
Old 08-23-2006
Error Getting the exit status of a remote command

Hi to everyone.

How can I get the exit status from a remote command executed with rexec? Smilie

machine A has RedHat Linux 9 and the remote machine B has SCO UNIX.

Code:

rexec -l user -p password host sh /u/files/scripts/seq_cal.sh 2006 08

I want the exit status returned by seq_cal.sh not the one returned by rexec. It always return 0, that means its execution was okay.

Thanks
 

10 More Discussions You Might Find Interesting

1. Programming

How to find the exit status of last command in Unix?

Hi, I want to find the exit status of the last executed command in C Shell. Tried $? but getting the error Variable syntax...$? does not seem to work in C shell.. is there any other command in C shell to find the exit status of last command? Thanks in advance, raju (1 Reply)
Discussion started by: rajugp1
1 Replies

2. UNIX for Dummies Questions & Answers

how to find the exit status for the last executed command

I am executing a find command in my script i.e find $2 -type f -name '*.gif' -mtime +$1 -exec rm {} \; how do i check that this command is executed properly.. i would lke t trap the errror and display my error message kinly help.. this is an urgent issue. (1 Reply)
Discussion started by: vijay.amirthraj
1 Replies

3. UNIX for Dummies Questions & Answers

exit status of command in a pipe line

Hi, I am trying to test the exit status of the cleartool lsvtree statement below, but it doesn't seem to be working due to the tail pipe, which it is testing instead. Is there a way around this without adding a tonne of new code? cleartool lsvtree $testlocation/$exe_name | tail -15 ... (10 Replies)
Discussion started by: topcat8
10 Replies

4. UNIX for Dummies Questions & Answers

Move Command and exit status problem

Hi All, I am using the following code to move files from one folder to another on the remote server: ssh username@server <<EOF cd source_dir find . -type f -name "*.txt" |xargs -n1000 -i{} mv {} dest_dir if then send mail indicating error otherwise echo "success" fi EOF ... (1 Reply)
Discussion started by: visingha
1 Replies

5. Shell Programming and Scripting

Move Command and exit status problem

Hi All, I am using the following code to move files from one folder to another on the remote server: ssh username@server <<EOF cd source_dir find . -type f -name "*.txt" |xargs -n1000 -i{} mv {} dest_dir if then send mail indicating error otherwise echo "success" fi EOF ... (10 Replies)
Discussion started by: visingha
10 Replies

6. HP-UX

Logins command exit status is 236 not 0

I have noticed that on version 11.23 I get exit status 236 from the following command: logins -oxl root ; echo $? > 236 However on 11.31 I get the expected code 0 logins -oxl root ; echo $? > 0 The output is correct for both versions and contains no error data. Can anyone explain... (2 Replies)
Discussion started by: parkea2
2 Replies

7. UNIX for Advanced & Expert Users

Equivalents of tee command to find exit status of command

Hi, Want to log the output of command & check the exit status to find whether it succeeded or failed. > ls abc ls: abc: No such file or directory > echo $? 1 > ls abc 2>&1 | tee log ls: abc: No such file or directory > echo $? 0 Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

8. UNIX for Dummies Questions & Answers

Exit Status Of Find Command

Hello All, I am trying to capture the exit status of find command and want to delete the files only when it is successful. But it is always returning me as success even if the pattern of that file doesn't exist in the current directory. please help, checked manual page but couldn't able to figure... (6 Replies)
Discussion started by: Ariean
6 Replies

9. Shell Programming and Scripting

Exit Status of Command

Hi All, I am doing an export and import (datapump) of 4 schema. I know we can do an export of 4 schema in one command. But just want to know how to check the exit status if i do the export/import of 4 schema in different commands in background. Please suggest. Thanks, Mani (1 Reply)
Discussion started by: pvmanikandan
1 Replies

10. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies
rexec(3x)																 rexec(3x)

Name
       rexec - return stream to a remote command

Syntax
       rem = rexec(ahost, inport, user, passwd, cmd, fd2p);
       char **ahost;
       u_short inport;
       char *user, *passwd, *cmd;
       int *fd2p;

Description
       The  subroutine	looks  up the host *ahost using returning -1 if the host does not exist.  For further information, see Otherwise *ahost is
       set to the standard name of the host.  If a username and password are both specified, then these are used to authenticate  to  the  foreign
       host.  If all this fails, the user is prompted for the information.

       The  port  inport specifies which well-known DARPA Internet port to use for the connection; it will normally be the value returned from the
       call ``getservbyname("exec", "tcp")''.  For further information, see The protocol for connection is described in detail in

       If the call succeeds, a socket of type SOCK_STREAM is returned to the caller and given to the remote command as stdin and stdout.  If  fd2p
       is  nonzero,  then  an auxiliary channel to a control process will be set up, and a descriptor for it will be placed in *fd2p.  The control
       process will return diagnostic output from the command (unit 2) on this channel and will also accept bytes on this channel  as  being  UNIX
       signal  numbers, to be forwarded to the process group of the command.  If fd2p is 0, then the stderr (unit 2 of the remote command) will be
       made the same as the stdout and no provision is made for sending arbitrary signals to the remote process, although you may be able  to  get
       its attention by using out-of-band data.

See Also
       gethostent(3n), getservent(3n), rcmd(3x), rexecd(8c)

																	 rexec(3x)
All times are GMT -4. The time now is 10:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy