how to run an already made script run against a list of ip addresses solaris 8 question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to run an already made script run against a list of ip addresses solaris 8 question
# 1  
Old 01-02-2012
how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question.

the script goes away and check traffic information, for example

check_GE-VLANStats-P3 1.1.1.1

and returns the results ok.

how do I run this against an ip list? i.e a list of 30 ip addresses

Last edited by Scott; 01-06-2012 at 03:54 PM.. Reason: Restored
# 2  
Old 01-02-2012
If you have ssh enabled, try this...

Code:
IPLIST="192.168.1.1 192.168.1.2"
for ip in $IPLIST
do
  ret=$( ssh $ip /full/path/to/script )
  echo $ret
done

How to setup SSH, please search the forum! If you don't want SSH, use rsh or rlogin which is less secure.

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 01-02-2012
Quote:
Originally Posted by ahamed101
If you have ssh enabled, try this...

Code:
IPLIST="192.168.1.1 192.168.1.2"
for ip in $IPLIST
do
ret=$( ssh $ip /full/path/to/script )
echo $ret
done

How to setup SSH, please search the forum! If you don't want SSH, use rsh or rlogin which is less secure.

--ahamed



# IPLIST="ip_list"
[root@V440]# for ip in $IPLIST
> do
> ret=$( ssh $1 /opt/tools/utils/HUB/GEW-VLANStats-P3 )
> echo $ret
> done
bash: ssh: command not found

Last edited by Scott; 01-06-2012 at 03:55 PM.. Reason: Restored
# 4  
Old 01-02-2012
You don't have ssh? Smilie
Paste the output of which ssh

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 5  
Old 01-02-2012
do you know why this will be ?


[name@V440]# ls
check_GE-VLANStats-P3

[name@V440]# more check_GE-VLANStats-P3
/opt/tools/utils/commands $1 /opt/tools/utils/HUB/GEW-VLANStats-P3

[name@V440]# pwd
/opt/tools

---------- Post updated at 01:34 PM ---------- Previous update was at 01:32 PM ----------

Quote:
Originally Posted by ahamed101
You don't have ssh? Smilie
Paste the output of which ssh

--ahamed

ssh works to the ip addresses ok when running the script on an individual ip address


name@V440]# which ssh
/usr/local/bin/ssh

Last edited by Scott; 01-06-2012 at 03:56 PM.. Reason: Restored
# 6  
Old 01-02-2012
Use the full path of ssh in that case
Code:
ret=$( /usr/local/bin/ssh $ip /opt/tools/utils/HUB/GEW-VLANStats-P3 )

Please make sure the variable IPLIST is populated correctly with the required IP address only separated by space as shown in the previous post.
Also, why did you use $1 in your code?

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 7  
Old 01-02-2012
of that script it will

#ssh -l 1.1.1.1
enter password
#telnet 169.1.1.1
enter user & password
#aux_stats -v
and print output (need it run twice i.e aux_stats -v to produce a comparison)

---------- Post updated at 01:40 PM ---------- Previous update was at 01:38 PM ----------

Quote:
Originally Posted by ahamed101
Use the full path of ssh in that case
Code:
ret=$( /usr/local/bin/ssh $ip /opt/tools/utils/HUB/GEW-VLANStats-P3 )

Please make sure the variable IPLIST is populated correctly with the required IP address only separated by space as shown in the previous post.
Also, why did you use $1 in your code?

--ahamed
required ip address of a particular site? I need it to compare from the list ip_list?

$1 i copied this from $1 /opt/pds-tools/utils/HUB/GEW-VLANStats-P3 output

---------- Post updated at 01:47 PM ---------- Previous update was at 01:40 PM ----------

I think you misunderstood let me explain, the script runs ok against 1 ip address

i.e

check_GE-VLANStats-P3 1.1.1.1

and produces output ok.

I need to run it against and ip list
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to run #groups command on list in a file

I have to provide a listing of all usernames and group assignments on Linux servers running SLES 12 SP 3. I am trying to automate this via a #for loop. It is not doing as desired and could use a little assistance. Here is the code: #!/bin/bash for uname in 'cat $(hostname)_unlist.txt' do... (8 Replies)
Discussion started by: Kentlee65
8 Replies

2. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

3. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

4. AIX

My script didn't run every run every minute at cronjob

In my cronjob, I would like to schedule my script.sh to run every minutes. I crontab -e and have in line below but it didn't seems to run at all. * * * * * script.sh When I run it manually, I can run it. Is that anything wrong with the above line? If I change it to something like below,... (4 Replies)
Discussion started by: ngaisteve1
4 Replies

5. Shell Programming and Scripting

Question regarding shells and subshells when a script is run

I have the following script running with nohup on one of my servers: #!/bin/bash #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #set log number #i=1 #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #Check if log exits, if so incrememnt log number up so we don't clobber #while... (8 Replies)
Discussion started by: DeCoTwc
8 Replies

6. UNIX for Dummies Questions & Answers

help to make list of files and run script..

Hey, I have finally made a command that works and now has to run it on 200+ files to run it on. How do I do that? Just fyi and if it complicates anything my commandline is: awk '{if ($1 ~ /1/) print $2}' file (yup, is should print $2 if $1 is a certain value) It doesn't work when I: ... (2 Replies)
Discussion started by: lost
2 Replies

7. Solaris

how do I start a script in run level 3 in solaris?

Hi, how do I start a script in run level 3 in solaris? (4 Replies)
Discussion started by: mokkan
4 Replies

8. UNIX for Dummies Questions & Answers

Made command into a script but now won't run

Hello, After seeing in a Unix cheatsheet that I could add commands into a file and run that file as a command to save on typing, i tried it with this: #! /bin/csh # Backup website excluding directories that do not change rsync -e "ssh -p 2222" -axzvc --progress --stats --compress-level=9... (9 Replies)
Discussion started by: patwa
9 Replies

9. UNIX for Advanced & Expert Users

script to run different shells which run different processes

Hi, Would like to ask the experts if anyone knows how to run a script like this: dtterm -title shell1 run process1 on shell1 dtterm -title shell2 run process2 on shell2 cheers! p/s: sorry if i used the wrong forum, quite concussed after watching world cup for several nights; but I... (2 Replies)
Discussion started by: mochi
2 Replies
Login or Register to Ask a Question