05-08-2008
problem with ssh or loop (can anyone know the issue)
Dear Members,
exec 0<$SuppFile
while read LINE
do
echo $LINE
gatewayArchive=`ssh root@mrp-gateway "cd /usr/local/apache/data/PLAT/MIMUS/upload/PROD/archive && ls $LINE"`
echo "gateway files :"$gatewayArchive
done
--------------------
when i remove ssh root@mrp-gateway command line in this script then loop is repeating
when i put this command and running the script, this loop is not repeating
it going upto last line (before done) and stopping over there
please can anyone tell me what is the problem here
It could be help me a lot in my program,
my whole programming logic is strucking here
Thanks
Krish.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I use the following command to check if my_base is active or not :
active_db=`${LOCAL_BIN}/ssh -l ${my_user} ${my_service} "ps -ef | grep ora_smon | grep ${my_base} | sed -e \"s/ */ /g\" | cut -d'?' -f2 | cut -d' ' -f3 | cut -d'_' -f3"`
When I use a file listing databases to check them... (1 Reply)
Discussion started by: madmat
1 Replies
2. Shell Programming and Scripting
Hi all,
I am trying to run a script which is expected to do:
on the remote machine,
There are two directories /export/home/abc1,/export/home/abc2
i am trying to do,
ssh SERVERNAME "for i in `ls -l /export/home/abc*|awk '{print $9}'`; do cd $i; ls -l; done"
But its not working ,iam... (11 Replies)
Discussion started by: Jartan
11 Replies
3. Shell Programming and Scripting
How do you do an ssh on a for statement. I have done ssh on individula lines of code before with no problems.
#!/usr/bin/ksh
cat server_list.txt | while read line
do
ssh $line "for i in `lslpp -l |grep tsm`
do
lslpp -Lc $i |grep -v State |tr ':' ',' |awk -F, '{print $2, "," ,... (4 Replies)
Discussion started by: din
4 Replies
4. Shell Programming and Scripting
Hi,
The requirement is to ssh to unix servers and oracle databases, to perform some monitoring activity. I'm using shell script to perfom this.
I pass the server details and database to a variable ...
SERVERS="SERVER1 SERVER2 SERVER3"
DATABASE="DB1 DB2 DB3"
for i in $SERVERS
do
ssh... (2 Replies)
Discussion started by: senthil3d
2 Replies
5. UNIX for Dummies Questions & Answers
Hi all,
I am facing an issue while trying to access a for loop variable inside ssh. Can anyone please help me with what this issue is, the following is the code that I have ->
IMPL_LOG_FOLDERS=(transaction_logs invalid_transaction_logs)
sshg3 ftp_id@boxname << EOS
for log_folder in... (5 Replies)
Discussion started by: anindyabecs
5 Replies
6. Shell Programming and Scripting
Here is the smallest extract to demonstrate the problem that I experience.
#!/bin/bash
r=$1
while read ip
do
if ] ;then
x=`ssh $ip echo "$ip"`
else
x=`echo "$ip"`
fi
echo $x
done << EOF
192.168.8.241
192.168.8.241
EOF
# Any IP with public key set (0 Replies)
Discussion started by: ivolvo
0 Replies
7. Shell Programming and Scripting
I have written the following script to update some Debian boxes.
#!/bin/bash
mxg_hosts_file="/etc/mxg/ssh-hosts"
while read line ; do
mxg_host="$(echo ${line} | awk -F":" '{print $1}')"
mxg_port="$(echo ${line} | awk -F":" '{print $2}')"
echo "Connecting and Upgrading... (3 Replies)
Discussion started by: jelloir
3 Replies
8. AIX
Hi,
I am having a file like,
#cat file
Jun 19 13:08
Jun 19 13:08
Jun 19 13:08
Jun 19 13:14
when I run the below comamnd locally it will work fine,
IFS=$'\n'; for i in $(cat file) ;do echo "HI $i" ; done
And the output is,
HI Jun 19 13:08
HI Jun 19 13:08
HI Jun 19 13:08
HI... (1 Reply)
Discussion started by: sumanthupar
1 Replies
9. Shell Programming and Scripting
I read a file (iplist.txt) ine-by-line in a loop which has the list of all the server hostnames.
With each hostname read; I do ssh and fire multiple commands to gather information about that systemas shown below.
#!/bin/bash
while IFS='' read -r line || ]; do
echo "Text read from file:... (3 Replies)
Discussion started by: mohtashims
3 Replies
10. UNIX for Beginners Questions & Answers
Hi all,
I have observed that ssh exits while loop.
#!/bin/ksh
typeset -i i
typeset -i size
set -A server = " " "SERVER1" "SERVER2"
i=2
while ]
do
while read in_module
do
print $in_module
size=`ssh ${server} ls -l $in_module 2>/dev/null | awk '{print $5}'`
... (3 Replies)
Discussion started by: Soham
3 Replies
pg(3erl) Erlang Module Definition pg(3erl)
NAME
pg - Distributed, Named Process Groups
DESCRIPTION
This (experimental) module implements process groups. A process group is a group of processes that can be accessed by a common name. For
example, a group named foobar can include a set of processes as members of this group and they can be located on different nodes.
When messages are sent to the named group, all members of the group receive the message. The messages are serialized. If the process P1
sends the message M1 to the group, and process P2 simultaneously sends message M2 , then all members of the group receive the two messages
in the same order. If members of a group terminate, they are automatically removed from the group.
This module is not complete. The module is inspired by the ISIS system and the causal order protocol of the ISIS system should also be
implemented. At the moment, all messages are serialized by sending them through a group master process.
EXPORTS
create(PgName) -> ok | {error, Reason}
Types PgName = term()
Reason = already_created | term()
Creates an empty group named PgName on the current node.
create(PgName, Node) -> ok | {error, Reason}
Types PgName = term()
Node = node()
Reason = already_created | term()
Creates an empty group named PgName on the node Node .
join(PgName, Pid) -> Members
Types PgName = term()
Pid = pid()
Members = [pid()]
Joins the pid Pid to the process group PgName . Returns a list of all old members of the group.
send(PgName, Msg) -> void()
Types PgName = Msg = term()
Sends the tuple {pg_message, From, PgName, Msg} to all members of the process group PgName .
Failure: {badarg, {PgName, Msg}} if PgName is not a process group (a globally registered name).
esend(PgName, Msg) -> void()
Types PgName = Msg = term()
Sends the tuple {pg_message, From, PgName, Msg} to all members of the process group PgName , except ourselves.
Failure: {badarg, {PgName, Msg}} if PgName is not a process group (a globally registered name).
members(PgName) -> Members
Types PgName = term()
Members = [pid()]
Returns a list of all members of the process group PgName .
Ericsson AB stdlib 1.17.3 pg(3erl)