Sponsored Content
Full Discussion: RSH command
Top Forums Shell Programming and Scripting RSH command Post 82314 by blowtorch on Tuesday 30th of August 2005 10:09:00 PM
Old 08-30-2005
What exactly are you trying to do? Do you want to check the exit status of the remote command? I think that you could do it this way:
Code:
remsh "$HOST" test -e /home/test.script \&\& echo "yes"

The yes will be printed only if the test result is successful, but it will be printed on the local host, so you can store this in a variable and check the variable for the result. Like this:
Code:
result=$(remsh "$HOST" test -e /home/test.script \&\& echo "yes")
if [ "$result" = "yes" ]; then
--remote command succeeded. do something--
else
--remote command failed. do something else--
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rsh command

Newbie here, I want to add a line to our 3D rendering scripts that will send an email to the animators once a scene has finished rendering. The 3D scripts are on the client hosts and the sendmail setup on the server. I tried using a rsh line in the script as follows rsh root@blah echo... (2 Replies)
Discussion started by: flamethrower
2 Replies

2. UNIX for Dummies Questions & Answers

rsh command

Hi, I'm performing a data migration from an Ingres db to an Oracle db. The ingres database lives on a unix host running "UNIX(r) System V Release 4.0 (SunOS 5.5.1) ", while the Oracle database lives on another unix host running "SunOS 5.8". Part of the migration is to remotely run Oracle's... (1 Reply)
Discussion started by: strpeski
1 Replies

3. UNIX for Dummies Questions & Answers

.rhosts and rsh command

Hello all, Ok. Here it the scope I have two Redhat 7.2 machine which I use to test things on. I have a home directory which is NFS mounted via NIS. I have a .rhosts file in the directory with the name of the machine and username, with permission 600. Be when I try to run a rsh command I get... (6 Replies)
Discussion started by: larry
6 Replies

4. Shell Programming and Scripting

rsh command in a while loop

Hi , reading a "file1" with 2 data in each line (VAR1 and VAR2) , i'm using a while loop like this : cat file1|awk '{print $1,$2}'|while read VAR1 VA2 do echo $VAR1 echo $VAR2 done as this example shows , it works but if between do and done i use a "rsh" command , the script reads... (6 Replies)
Discussion started by: Nicol
6 Replies

5. UNIX for Dummies Questions & Answers

rsh command

Hi, I am a beginner and i want to seek help I want to use the rsh command. Is there a possibility that i can do it without the system password I am planning to make a csh script that could browse/copy files from diferent workstations. thank you.... (5 Replies)
Discussion started by: wramonzon
5 Replies

6. Linux

rsh command

we want to execute remote script via rsh (we just only should use rsh except others),but rsh command can not set environment variable for specify user, then scripts can not be executed correctly,anyone knows how to fix this problem? thanks. (8 Replies)
Discussion started by: Frank2004
8 Replies

7. Solaris

Problems with rsh command

Hello guys, I have a script in a Linux server, from where I go to 3 Sun servers and run process. Now i have done an upgrade and increase 1 Sun server more, now i need to run the shell in the Linux Server (into the shell is rsh command), but when i try to do ir with the new Sun server, i hace the... (3 Replies)
Discussion started by: lestat_ecuador
3 Replies

8. Shell Programming and Scripting

rsh command

Hi Does anybody know how to to return the exit code of a remote command when using rsh? I know that "rsh" has no built-in ability for that. The echo $? is showing the results of the rsh command. Not the remotely executed command. I am trying to get the return code of psef command from... (4 Replies)
Discussion started by: aoussenko
4 Replies

9. Shell Programming and Scripting

rsh connection using embedded command

Hello, I am doing an rsh connection to server2. I want to perform several command on server2. I.E: i=1 rsh server1 -l username "z=$i;`script.ksh`" (1)Is this the right way to give z value to be used on server2? (2) Is this the right way to run a script on server2? (1 Reply)
Discussion started by: LiorAmitai
1 Replies

10. Shell Programming and Scripting

rsh command - ksh

Hello, I am trying to run a remote file (y.ksh) using rsh. In this action i want to use an environment variable TOOL=/home/macc1 i am running the rsh from profile macc on server1. rsh server2 -l macc1 "$TOOL/y.ksh" but i can see that the executable command = /home/macc/y.ksh and not... (1 Reply)
Discussion started by: LiorAmitai
1 Replies
RSH()																	     RSH()

NAME
rsh - remote shell SYNOPSIS
rsh host [-l username] [-n] [-d] [-k realm] [-f | -F] [-x] [-PN | -PO] command DESCRIPTION
Rsh connects to the specified host, and executes the specified command. Rsh copies its standard input to the remote command, the standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. This implementa- tion of rsh will accept any port for the standard error stream. Interrupt, quit and terminate signals are propagated to the remote com- mand; rsh normally terminates when the remote command does. Each user may have a private authorization list in a file .k5login in his login directory. Each line in this file should contain a Ker- beros principal name of the form principal/instance@realm. If there is a ~/.k5login file, then access is granted to the account if and only if the originater user is authenticated to one of the princiapls named in the ~/.k5login file. Otherwise, the originating user will be granted access to the account if and only if the authenticated principal name of the user can be mapped to the local account name using the aname -> lname mapping rules (see krb5_anadd(8) for more details). OPTIONS
-l username sets the remote username to username. Otherwise, the remote username will be the same as the local username. -x causes the network session traffic to be encrypted. -f cause nonforwardable Kerberos credentials to be forwarded to the remote machine for use by the specified command. They will be removed when command finishes. This option is mutually exclusive with the -F option. -F cause forwardable Kerberos credentials to be forwarded to the remote machine for use by the specified command. They will be removed when command finishes. This option is mutually exclusive with the -f option. -k realm causes rsh to obtain tickets for the remote host in realm instead of the remote host's realm as determined by krb_realmofhost(3). -d turns on socket debugging (via setsockopt(2)) on the TCP sockets used for communication with the remote host. -n redirects input from the special device /dev/null (see the BUGS section below). -PN -PO Explicitly request new or old version of the Kerberos ``rcmd'' protocol. The new protocol avoids many security problems found in the old one, but is not interoperable with older servers. (An "input/output error" and a closed connection is the most likely result of attempting this combination.) If neither option is specified, some simple heuristics are used to guess which to try. If you omit command, then instead of executing a single command, you will be logged in on the remote host using rlogin(1). Shell metacharacters which are not quoted are interpreted on the local machine, while quoted metacharacters are interpreted on the remote machine. Thus the command rsh otherhost cat remotefile >> localfile appends the remote file remotefile to the local file localfile, while rsh otherhost cat remotefile ">>" otherremotefile appends remotefile to otherremotefile. FILES
/etc/hosts ~/.k5login (on remote host) - file containing Kerberos principals that are allowed access. SEE ALSO
rlogin(1), kerberos(3), krb_sendauth(3), krb_realmofhost(3) BUGS
If you are using csh(1) and put a rsh(1) in the background without redirecting its input away from the terminal, it will block even if no reads are posted by the remote command. If no input is desired you should redirect the input of rsh to /dev/null using the -n option. You cannot run an interactive command (like rogue(6) or vi(1)); use rlogin(1). Stop signals stop the local rsh process only; this is arguably wrong, but currently hard to fix for reasons too complicated to explain here. RSH()
All times are GMT -4. The time now is 09:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy