How to run cmd from Server A on Server B

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to run cmd from Server A on Server B
# 1  
Old 06-21-2011
How to run cmd from Server A on Server B


I need some help to improve the execution time for my script.

Here is the case.
i have one Test1 script on server 'A'.
This script Test1 writes some cmd in file cmds.txt
Now i am running running these cmd which is written in file cmds.txt on more than 5 different servers using ssh. as below

ssh serverB < cmds.txt
ssh serverC < cmds.txt

Now here is the problem, it takes lot of time tio execute these cmd on different server.
My concern is, Is there any other way by which we can execute these cmd on different servers with less execution time.
# 2  
Old 06-21-2011
use -f, so that ssh will run in background

so all ssh commands will be triggered immediately

ssh -f user@machine < cmds.txt

# 3  
Old 06-21-2011
Thanks for the reply.
however i am not getting the output of the cmds written in the cmds.txt.
$cat cmds.txt
ls -lrt | tail

here is the cmd wothout -f
$ssh serevrA 2>/dev/null <cmds.txt
output is below
-rw-r--r-- 1 asd dsa 381 Jun 21 04:02 sdjfhg.txt
-rw-r--r-- 1 asd dsa 381 Jun 20 04:02 sdfg.txt

with -f option no output.
# 4  
Old 06-21-2011
try like this...

your output will be stored in the /tmp/output file

$ssh serevrA > /tmp/output 2>/dev/null <cmds.txt

# 5  
Old 06-21-2011
by doing this way my concern still exist, means still it is taking more execution time.
Is there any other way by which we can run some cmds on different server(box) without using ssh or in efficient way.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

CMD to check status of the server using Wget

Hi All, Using Wget I'm able to get the status of the server.....only when the server is completely down or up.... but problem here in script is Suppose if the server got hang I mean to say that if the server is taking long time to login, for example normally the server takes 3 seconds to login... (3 Replies)
Discussion started by: manohar2013
3 Replies

2. Shell Programming and Scripting

Execute command using ssh server 'cmd'

Hi The command below does not work as it require to take command in the breakers But If I do so the variable values get lost ssh testserver01 'dsmc q b "${ARCHIVE_DIR}*" -sub=yes -querysummary -inactive -fromd="${BACKUP_DATE}"' Thank you. (3 Replies)
Discussion started by: zam
3 Replies

3. UNIX for Dummies Questions & Answers

Transfer file from server B to server C and running the script on server A

I have 3 servers A, B, C and server B is having some files in /u01/soa/ directory, these files i want to copy to server C, and i want to run the script from server A. Script(Server A) --> Files at Server B (Source server) --> Copy the files to Server C(Target Server). We dont have RSA key... (4 Replies)
Discussion started by: kiran_j
4 Replies

4. Shell Programming and Scripting

KSH fetching files from server A onto server B and putting on server C

Dear Friends, Sorry for this basic request. But I just started learning Ksh recently and still I am a newbie in this field. Q: I have files on one server and the date format is which has year (yyyy) month (mm) and date (dd). I have these files on server A. The task... (8 Replies)
Discussion started by: BrownBob
8 Replies

5. Shell Programming and Scripting

how to use reset_server (siebel server) cmd in shell script

hello frnds, im using a script to stop, reset and to start the siebel server.. i'm able to extract the enterprise name, siebel server name and siebel root path.. when i try to use these info in the script im unable to perform the reset_server -r <siebel root> -e <enterprise name> +-M... (3 Replies)
Discussion started by: kaushik_87
3 Replies

6. Shell Programming and Scripting

Need help on how to exit a script run on a server from a remote server

hi, I am using the below line to run a script from remote server(say server A) to another server(say server B). ssh username@servername ksh script name. The issue is the script logs into server B, executes the script on server B, transfers the file to server A but does not exit from... (4 Replies)
Discussion started by: yohasini
4 Replies

7. Shell Programming and Scripting

Run script from another server

If i have one server processing some feeds and creating a database. Then i want to copy the relevant tables from the first server to the second server. I have a shell script to do the copy. I was going to make a cron to run the script at a certain time. But it would not be ideal. I really want... (8 Replies)
Discussion started by: timgolding
8 Replies

8. Shell Programming and Scripting

Unix cmd prompt how to get old cmd run?

Hi, I am using SunOS I want to serch my previous command from unix prompt (like on AIX we can search by ESC -k) how to get in SunOs urgent help require. (10 Replies)
Discussion started by: RahulJoshi
10 Replies

9. UNIX for Dummies Questions & Answers

How to run a command on server

Hi, Im a total virgin on server admin and I need to check server (shared server) for certain files. Someone send me a command: find /home/ \( -name "*.cgi" -o -name "*.php" \) -print0 | xargs -0 egrep -l 'c99shell|r57shell|WebShell|phpshell|shell|c100|base64' >> /root/report my question is:... (1 Reply)
Discussion started by: Carl29
1 Replies

10. Virtualization and Cloud Computing

Cmd to start guest in VMware server 2.0

Is there any command in VMware Server 2.0 to poweron/start the guests like we have vmware-cmd ESX server 3.5 .. (1 Reply)
Discussion started by: fugitive
1 Replies
Login or Register to Ask a Question