Friday, 27 September 2013

Bash script to find apache servers

Bash script to find apache servers

I apologize if I haven't properly searched every possible post on this but
all seem a little different and I'm starting to get crossed eyed looking
at this.
The following bash code is what I have so far.
for server in cat serverlist2.txt; do ssh -q $server if ! ps -ef | grep -q
http ; then echo $server fi done
I'm new to bash scripting and I have to find all the hosts listed in the
file serverlist2.txt that run apache (http) and then print the hostnames
where http is found. Any help would be greatly appreciated.

No comments:

Post a Comment