![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running a Script in a Remote server | ZeroGPX | Shell Programming and Scripting | 2 | 03-07-2008 05:07 PM |
| Running an informix query on remote server | sureshg_sampat | Shell Programming and Scripting | 2 | 10-09-2007 12:20 AM |
| Running remote shell script containing sql statements | Madbreaks | Shell Programming and Scripting | 4 | 05-16-2006 06:58 AM |
| running a script on remote server. | whited05 | Shell Programming and Scripting | 1 | 10-20-2005 02:07 AM |
| Running shell scripts on a remote server | pepintheshort | UNIX for Dummies Questions & Answers | 2 | 07-22-2003 01:20 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running ssh on a remote system?
I need to install ypbind and yp-tools on over two-hundred remote client machines based on their redhat version. I have a centralized server on which I created an ssh public key. I then transfered the ssh public key to the authorized_keys file on all the remote hosts; therefore, I can login without being prompted for a password. However, my script is not working as expected. The script will copy the tarball with ypbind and yp-tools to the remote host, but it will not extract the tarball on the remote host. Is there a way of doing this with just one server side script or possibly ssh using a coprocess? Any help would be greatly appreciated. The following is a copy of my script:
#!/bin/bash set -x SERVERS=`cat list` for MACHINE in $SERVERS do SYSREL=`/bin/ssh $MACHINE cat /etc/redhat-release` if [ "$SYSREL" = "Red Hat Enterprise Linux AS release 3 (Taroon Update 3)" ] then /bin/scp ciscolinux_nis_package.tar $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf /tmp/ciscolinu_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.8-1.i386.rpm /tmp/ypbind-1.12-5.i386.rpm elif [ $SYSREL = "Red Hat Linux release 9 (Shrike)" ] then /bin/scp redhat9_nis_package.tar $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf /tmp/redhat9_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.7-5.i386.rpm /tmp/ypbind-1.12-5.i386.rpm elif [ $SYSREL = "Red Hat Linux release 8 (Shrike)" ] then /bin/scp redhat8_nis_package $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf redhat8_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.7-3.i386.rpm /tmp/ypbind-1.11-2.i386.rpm elif [ $SYSREL = "Red Hat Linux release 7.3 (Valhalla)" ] then /bin/scp redhat7.3_nis_package.tar $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf /tmp/redhat7.3_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.6-4.i386.rpm /tmp/ypbind-1.10-7.i386.rpm elif [ $SYSREL = "Red Hat Linux release 7.2 (Enigma)" ] then /bin/scp redhat7.2_nis_package.tar $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf /tmp/redhat7.2_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.5-1.i386.rpm /tmp/ypbind-1.8-1.i386.rpm elif [ $SYSREL = "Red Hat Linux release 7.1sbe (Seawolf)" ] then /bin/scp redhat7.1_nis_package.tar $MACHINE:/tmp /bin/ssh $MACHINE tar -xvf /tmp/redhat7.1_nis_package.tar /bin/ssh $MACHINE rpm -ivh /tmp/yp-tools-2.4-7.i386.rpm /tmp/ypbind-1.7-8.i386.rpm else echo "Error install ypbind and yptools" fi done |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Try it with quotes...
/bin/ssh $MACHINE "tar -xvf redhat8_nis_package.tar" |
||||
| Google The UNIX and Linux Forums |