Script needed...

Hi!

I have a file which has a list of host, I want to ssh to each of the first box for an app and grep through the logs for version of the application and look for a certain string "Connection is open" in the log file. The file I am referring to looks like this -

prod1-doms-2001.corp.zap.com:App1-America:PROD:8000
prod2-doms-2001.corp.zap.com:App1-Asia:PROD:8020
prod3-doms-2002.corp.zap.com:App1-Europe:PROD:8040
prod1-doms-2001.corp.zap.com:App2-America:PROD:9000
prod2-doms-2001.corp.zap.com:App2-Asia:PROD:9020
prod3-coms-2002.corp.zap.com:App2-Europe:PROD:9040

where columns are separated by colons -

First column - hostname
Second column - app name 
Third column - env name
Forth column  - port #

I want to ssh to first host of each app then grep for a string called "connection is open" and also parse out (20100613) from a string of line like the following from the log file -

.... -JbossRootDirectory=/remote/QB/packages/App1-20100712-133944-249b7220ac454586864a7...

Currently I am doing this manually but since there are some 30 hosts, I want to have this executed from a central admin box.

The log file name changes with appname and hostname /port and is of the pattern - /App1-region_prod1-doms-2001.corp_8000

Please share if someone has developed a script which can do this. I want to do this after restart of each app.

Thanks,
Allan

Have you tried to write it? Now is a good time to learn so you can be self sufficent in the future. If you write it yourself you will appreciate the time saved later :wink: This can be done with a small/simple shell script. Try to write it first. There are many examples to look at.