02-10-2011
Using ssh command inside a script
Hi,
I have a script file in server A. Inside the script file, I first have a ssh command that will connect to a remote server B. In the same script file itself, I have a sequence of commands that has to be run in server B. I am embedding these commands in the script file that I have in server A. When i run the script file in server A, it first gets connected to server B but nothing happens for sometime after which i get Connection timeout and some error in the command.
Is there a restriction in the kind of commands that can be executed in server B from server A with the scenario as mentioned above?
Instead of a script file, when i execute the commands one by one in console in server B it is getting executed. ie) first i connect to server B from server A using ssh and then run the commands one by one in server B. I want these commands to be placed in a script file and executed from server A.
Kindly provide a solution.
Thanks in advance.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Okay I have this script file that runs from cron and most the time it works just find. Except every so often one of the three ssh commands I have in it just doesn't know it's done and that of course causes the whole thing to hang!
The ssh command has executed. I can tell this because the command... (1 Reply)
Discussion started by: stilllooking
1 Replies
2. Shell Programming and Scripting
set -A arr a1 a2 a3 a4
# START
ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS
integer j=0
for loop in ${arr}
do
printf "array - ${arr}\n"
(( j = j + 1 ))
j=`expr j+1`
done
EOS
# END
=========
this is not giving me correct output.
I... (5 Replies)
Discussion started by: reldb
5 Replies
3. Shell Programming and Scripting
Hi,
When runnin the following script it complte successfully with out any problem
#!/bin/sh
SERV="crm1"
for s in $SERV
do
export WebLogicSessions=`ssh psoft@$s "cd /software/psoft/scripts ; ./getweblogicsessions.sh crm1 8001 PIA | awk '{print $1}' `
echo "Checking number of... (0 Replies)
Discussion started by: yoavbe
0 Replies
4. Shell Programming and Scripting
Hi everyone,
when executing this command in unix:
echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error.
here is content of my script:
tdbsrvr$ vi hc.sh
"hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies
5. Shell Programming and Scripting
Hi All,
Is there any way to monitor a command inside shell script ? I have a script inside which I have a tar command which zips around 200GB data.
tar zcvf $Bckp_Dir/$Box-BaseBackup-$Day.tar.gz * --exclude 'dbserver_logs/*' --exclude postmaster.pid --exclude 'pg_xlog/*'
I want to... (3 Replies)
Discussion started by: sussus2326
3 Replies
6. Shell Programming and Scripting
Hi,
I've written a very robust script to get an external IP address from 'behind' a router. It uses many web pages randomly choosing which one/ones to use at run time. The "fetch the web page containing the IP address" is handled by either wget or curl both of which have their 'max time for the... (6 Replies)
Discussion started by: gencon
6 Replies
7. Shell Programming and Scripting
Hi ,
DIR1 has only one file with .txt extension , trying to get the size of that file using the following script
#!/bin/ksh
foldr_1="/etc/DIR1"
#echo "$foldr_1"
sze_fdr1=$(ls -ltr foldr_1/*.txt |awk '{ print $5 }')
echo "$sze_fdr1"
After executing the above script getting... (1 Reply)
Discussion started by: smile689
1 Replies
8. Shell Programming and Scripting
Hi ,
I am trying to read a list of hosts from a config file and trying to get file list from that host. For this I have used one while loop.
cat "$ARCHIVE_CFG_FILE" | sed '/^$/d' | sed '/^#/d' | while read ARCHIVE_CFG
do
SOURCE_SERVER_NAME=`echo "$ARCHIVE_CFG" | awk -F '|' '{ print... (2 Replies)
Discussion started by: Anupam_Halder
2 Replies
9. UNIX for Advanced & Expert Users
I am trying to run an awk command inside of ssh and it is not working. These are AIX servers.
for i in `cat servers`; do ssh $i "/bin/hostname; df -g | awk '/dev/ && $4+0 > 70'"; done
server1
server2
server3
server4
I also tried these two methods and they did not work. It just seemed... (5 Replies)
Discussion started by: cokedude
5 Replies
LEARN ABOUT DEBIAN
bubbros-server
bubbros-server(6) Games Manual bubbros-server(6)
NAME
bubbros-server - the bub-n-bros server.
SYNOPSIS
bubbros-server [ level-file.bin ] [options]
DESCRIPTION
bubbros-server starts an http server that acts as a control panel for the server. The server listens on port 8000 by default. The url for
the control panel is http://server:port/0xN where 0xN is a random hex number (acts as minimal protection). This url is printed when the
server starts. You can start and view games and kill the server from this panel. The control panel also allows you to type in the address
of a server to connect to, the script will then open a client to that server. The http server also servers java applet clients for those
players who wish to use one.
When a game is started the script opens a port for the game server. This port can then be connected to by a client. Clients autodetect
servers running on the local network with UDP ping on port 8056.
Connection forming
The client forms a tcp connection to the server. Or, when using the metaserver, the server forms a connection to the client. If this fails,
the client and server try a simultaneous SYN connect. This sometimes works if the server and client are behind firewalls. The server then
tries to transmit the data over udp. If it gets no response from the client it will fall back to the existing tcp connection.
OPTIONS
-b N, --begin N, --start N
Start at board (level) number N. The default is 1. See also the -s option.
-h, --help
Display help.
-i, --infinite
Restart the server at the end of the game. Normally the server quits after a certain period of inactivity. This is useful when used
with the -m option to make a public server that is available for a long time.
-l N, --lives N
Limit number of lives to N. If this option is not specified the number of lives will be infinite.
-m, --metaserver
Register server with the Metaserver (currently) at codespeak.net:8050. This makes your server visible to everybody, and also facil-
itates joining through a fascistic firewall.
--port TYPE=N Sets default listening ports. If type is LISTEN , sets the game server port to N. The game server port is chosen randomly by
default. If the type is HTTP , sets the http server port to N. The http server port defaults to 8000. Another port will be chosen
if none was specified and 8000 is already in use. The server also listens to UDP ping on port 8056.
-s N, --step N
Increase board number with N when a board is completed. Defaults to 1. see also the -b option.
OUTPUT
The server outputs helpful debug information concerning the http and game servers.
SEE ALSO
bubbros(6) bubbros-client(6)
December 7, 2007 bubbros-server(6)