Sponsored Content
Top Forums Shell Programming and Scripting How To Run A For Loop In A Remsh? Post 302506178 by methyl on Friday 18th of March 2011 06:12:49 PM
Old 03-18-2011
My advice. Protecting Shell special characters in a complex "remsh" line will drive you nuts. It is so important to be aware which Shell special characters will be executed on the local computer and which will be executed on the remote computer. It is not impossible to achieve but please bear in mind the next administrator who reads your code.

The professional approach is to first proliferate the script to each of the remote servers and then invoke the script from a "remsh" command.
This approach means that you can test the script while logged in to the remote server.
This User Gave Thanks to methyl For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remsh and run script

Help! I'm would like to log in su - within a script an contuine to run the commands within the script. Every time I log in as su - I have to exit for the rest of the script to run! e.g. #!/bin/ksh su - oracle ps -ef |grep som <--- doesn't excute command until I log out su oracle.... (1 Reply)
Discussion started by: bugggg
1 Replies

2. Shell Programming and Scripting

The loop does not run as expected

Hi folks, I have the following configuration file: DB_LAYER=NO ADMIN_LAYER=NO RTESUB_LAYER=NO DB_HOST_NAME=tornado ADMIN_HOST_NAME=tornado RTESUB_HOST_NAME=tornado RESPONSE_FILE_SR=/tmp/SR.rsp INSTALL_SR_1=/home/Upgrade_4.7.1/Utilities/Install_SR:Y... (8 Replies)
Discussion started by: nir_s
8 Replies

3. Shell Programming and Scripting

remsh newhost "for loop"

Hi, In ksh how can I execute something like this: remsh newhost "for i in 1 2 3 4 5 do echo file$i; cat file$i; done" I cannot pass the contrl J or enter in th above line which is required by the for loop. Thanks... (1 Reply)
Discussion started by: alantang
1 Replies

4. UNIX for Advanced & Expert Users

remsh inside of while loop

I have a space delimited file containing: hostname OracleSID connectstring I want to loop through the file and execute remsh to check the database processes. cat $filename | while read HOST SID CONNECT do { result=`remsh $HOST "ps -ef | grep pmon_${SID}$| grep -v grep"` if ........ (1 Reply)
Discussion started by: joettacm
1 Replies

5. Shell Programming and Scripting

How To Run AWK via Remsh?

Boy I hope someone can answer this question. I've been beating my head against the wall all day trying to come up with a solution. I have a carrot delimited file that looks like this: ANDERSON^678934^1974^BOB JONES^564564345^1954^ABRAHAM SMITH^47568465^1948^JON If I run this command: awk... (6 Replies)
Discussion started by: Korn0474
6 Replies

6. Shell Programming and Scripting

Is there a better way I could have run this loop. (For loop with two variables)

Sorry for such a dreadful title, but I'm not sure how to be more descriptive. I'm hoping some of the more gurutastic out there can take a look at a solution I came up with to a problem, and advice if there are better ways to have gone about it. To make a long story short around 20K pieces of... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

7. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

8. Shell Programming and Scripting

How to run it in the loop??

I have this code awk -F, ' { C5+=$5 C6+=$6 C7+=$7 C8+=$8 R=$5+$6+$7+$8 T+=R } { print $0,R } END { print... (7 Replies)
Discussion started by: nikhil jain
7 Replies

9. Shell Programming and Scripting

Run the for loop in parallel

I have the below code which runs on multiple databases , but this runs one-after-one. I will need this to run in parallel so that i could save a lot of time. Please help!!! Thanks in advance for Db in `cat /var/opt/oracle/oratab |egrep -v "ASM" |grep -v \# |cut -d\: -f1` do { export... (5 Replies)
Discussion started by: jjoy
5 Replies

10. Shell Programming and Scripting

Trying to run a basic for loop

OS : RHEL 6.1 Shell : Bash I had a similair post on this a few weeks back. But I didn't explain my requirements clearly then. Hence starting a new thread now. I have lots of files in /tmp/stage directory as show below. I want to loop through each files to run a command on each file. I... (8 Replies)
Discussion started by: kraljic
8 Replies
IO::Async::Loop::Select(3pm)				User Contributed Perl Documentation			      IO::Async::Loop::Select(3pm)

NAME
"IO::Async::Loop::Select" - use "IO::Async" with "select(2)" SYNOPSIS
Normally an instance of this class would not be directly constructed by a program. It may however, be useful for runinng IO::Async with an existing program already using a "select" call. use IO::Async::Loop::Select; my $loop = IO::Async::Loop::Select->new; $loop->add( ... ); while(1) { my ( $rvec, $wvec, $evec ) = ('') x 3; my $timeout; $loop->pre_select( $rvec, $wvec, $evec, $timeout ); ... my $ret = select( $rvec, $wvec, $evec, $timeout ); ... $loop->post_select( $rvec, $evec, $wvec ); } DESCRIPTION
This subclass of "IO::Async::Loop" uses the select(2) syscall to perform read-ready and write-ready tests. To integrate with an existing "select"-based event loop, a pair of methods "pre_select" and "post_select" can be called immediately before and after a "select" call. The relevant bits in the read-ready, write-ready and exceptional-state bitvectors are set by the "pre_select" method, and tested by the "post_select" method to pick which event callbacks to invoke. CONSTRUCTOR
$loop = IO::Async::Loop::Select->new This function returns a new instance of a "IO::Async::Loop::Select" object. It takes no special arguments. METHODS
$loop->pre_select( $readvec, $writevec, $exceptvec, $timeout ) This method prepares the bitvectors for a "select" call, setting the bits that the Loop is interested in. It will also adjust the $timeout value if appropriate, reducing it if the next event timeout the Loop requires is sooner than the current value. $readvec $writevec $exceptvec Scalar references to the reading, writing and exception bitvectors $timeout Scalar reference to the timeout value $loop->post_select( $readvec, $writevec, $exceptvec ) This method checks the returned bitvectors from a "select" call, and calls any of the callbacks that are appropriate. $readvec $writevec $exceptvec Scalars containing the read-ready, write-ready and exception bitvectors $count = $loop->loop_once( $timeout ) This method calls the "pre_select" method to prepare the bitvectors for a "select" syscall, performs it, then calls "post_select" to process the result. It returns the total number of callbacks invoked by the "post_select" method, or "undef" if the underlying select(2) syscall returned an error. SEE ALSO
o IO::Select - OO interface to select system call AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Loop::Select(3pm)
All times are GMT -4. The time now is 04:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy