Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Saving output from background rsh command

17 views
Skip to first unread message

Tony

unread,
Jun 29, 2002, 12:27:54 AM6/29/02
to
Hi,
Hopefully one of you may be able to point me in the right direction.

I am trying to find the load on a range of nodes in a cluster.
I would like to store the uptime from each node in an array I can
create aggregate statistics about the system uptime.

When I rsh the uptime command to each node without the background
operator “&” rsh returns the output of uptime, via command
substitution,
to an array member. I would prefer to have each rsh uptime
call to be in the background (i.e. called with & at the end) so that I
can asynchronously scan the performance of the system. However, when
I include the &, the output from the rsh command is not saved in the
array.

I have tried to put a sleep command in the script to see if a delay
would help,
but it had no effect.

Does anyone have a hint as to how I can capture the output from a
background rsh command? I have included a code snippet below.

Thanks,
Tony

------------------code snippet----------------------------------------
# find the load for each node asynchronously
i=0
while [ $i -lt $count ]
do
# this rsh call returns output
uptimes[$i]=$(rsh ${node_names[$i]} uptime)

# this rsh call in the background does not save output
# uptimes[$i]=$(rsh ${node_names[$i]} uptime) &
let "i +=1"
done

# sleep for 5 seconds to let everyone reply
sleep 5s

# print the load for each node
i=0
while [ $i -lt $count ]
do
echo "node ${node_names[$i]} ${uptimes[$i]}"
let "i +=1"
done

mail.sac...@gmail.com

unread,
Feb 25, 2015, 1:29:00 AM2/25/15
to
Hi

Were you able to get a response or solve this issue?

Thanks.
0 new messages