Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rsh Command 1

Status
Not open for further replies.

Scunningham99

Programmer
Sep 20, 2001
815
GB
have just created an executable file as a test to print out directory structure ie

!#/bin/ksh

ls -R /user01 lsi /simon.bat


---
This works fine but when the directory listing has finnished
the rsh command is still there doing nothing. i need it to quit out of the rsh on the server that kicked the rsh off!!!

This is only a test as in one of our backup scripts on server A at the bottom once it has finnished i am telling it to kick off a backup script on server b, which it does so fine, but does not quit out of the rsh, and subsequently left the rsh command running (idle) on server A.
 
Hi, another Cunningham on board!

Could you not just add an exit at the end of your script? I'm not too sure about rsh, but no doubt others will be able to advise whether this would work. HTH.
 
Thanks, but I have managed to figure this out by passing the paramater -n to rsh. ie rsh -n lsi /simon.bat. this sends the input to the spawned process to /dev/null, which solves the problem.

Thanks Anyway. Simon
 
I'm not sure what you mean ... here's what I did ...

- create this script on server B
Code:
#!/bin/ksh
ls -R /user01 lsi /simon.bat

- on server A, issue the command

rsh serverB scriptname


All appears to work fine for me. I would also note that I have server B defined in my .rhosts file on server A

Can you post the exact script you are running on server B?

Greg.
 
Grega,

Upon completion of script on Server b, When you do a ps -ef|grep on {script name } does it return PID and script name???

 
No, no such processes running on either server. What happens if you log onto server B and run the script locally there? Does it run OK?

Greg.
 
HERE IS A COPY OF MY SCRIPT. THE PROBLEM IS THAT IT IS NOT QUITTING RSH EVEN THOUGH PROCESS HAS FINISHED ON REMOTE SERVER!!!

HENCE IT DOESNT QUIT OUT OF SCRIPT. HELP!?!?!?!


#!/bin/ksh

#
# Shell script to backup the entire system onto D(ave) L(ee) T(ravis) Drive
#

TODAY=`date +%d`;export TODAY

exec 1>/usr/local/lib/backups/backlog.$TODAY 2>&1

TAPERW=/dev/rmt/0c
TAPENR=/dev/rmt/0cn
TM=1

cd /
umask 000

# Shutdown the ORACLE database
echo "Shutting down the Oracle Database - `date`"
/user01/oracle/admin/scripts/clVIS

echo "Backup started at `date` ..."
for FS in `/usr/sbin/mount|awk '{ print $1 }'`
do
case "$FS" in
"/dev/fd"|"/tmp"|"/proc"|"/cdrom")
continue
;;
esac
echo "Backing up $FS to tape .. tapemark $TM .."
/usr/sbin/ufsdump 0uf $TAPENR $FS
TM=`expr $TM + 1`
sleep 10
done
# tar cvf /user04/prod_backup.tar /user0[2-4]/oradata/PRD1/*
# Startup the ORACLE database
echo "Starting up the Oracle Database - `date`"
/user01/oracle/admin/scripts/stVIS >/tmp/ora.open 2>&1


echo "Backup finished `date` ..."

rsh -n lsi /usr/local/bin/daily_backup;
mt -f $TAPERW rewoffl
cat /usr/local/lib/backups/backlog.$TODAY | lp -d 89_13
cat /usr/local/lib/backups/backlog.$TODAY | lp -d 89_6;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top