Created
March 17, 2014 08:43
-
-
Save nielsvanderbeke/9595877 to your computer and use it in GitHub Desktop.
script to get carto of all httpd installs on machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
echo "hostname;location;process owner;server version;server build;server mulde magic number;server loaded;comiled using;architecture;server MPM;threaded;forked;verbose compile info;modules" | |
http_bins=`ps -eaf | grep -v grep | grep httpd | awk '{ print $8 }' | sort | uniq` | |
for http_version in $http_bins ; do | |
http_build=`${http_version} -V` | |
http_owner=`ps -eaf | grep -v grep | grep ${http_version} | awk '{ print $1 }' | sort | uniq` | |
http_serverVersion=`echo -e "${http_build}" | grep "Server version" | awk '{ {print $3,$4} }'` | |
http_serverBuild=`echo -e "${http_build}" | grep "Server built" | awk '{ {print $3,$4,$5,$6} }'` | |
http_moduleMagicNumber=`echo -e "${http_build}" | grep "Server's Module Magic Number" | awk '{ {print $5} }'` | |
http_serverloaded=`echo -e "${http_build}" | grep "Server loaded" | awk '{ {print $3,$4,$5,$6} }'` | |
http_compiledUsing=`echo -e "${http_build}" | grep "Compiled using" | awk '{ {print $3,$4,$5,$6} }'` | |
http_Architecture=`echo -e "${http_build}" | grep "Architecture" | awk '{ {print $2} }'` | |
http_ServerMPM=`echo -e "${http_build}" | grep "Server MPM" | awk '{ {print $3} }'` | |
http_threaded=`echo -e "${http_build}" | grep "threaded:" | awk '{ {print $2} }'` | |
http_forked=`echo -e "${http_build}" | grep "forked" | awk '{ {print $2} }'` | |
http_verboseCompile=`echo -e "${http_build}" | grep " -D " | sed 's/\ -D //g' | sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}'` | |
http_modulesDir=`echo -e ${http_version} | sed 's/bin\/httpd/modules/g'` | |
if [ -d $http_modulesDir ]; then | |
http_modules=`ls $http_modulesDir | sort | sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}'` | |
fi | |
echo "${HOSTNAME};$http_version;$http_owner;$http_serverVersion;$http_serverBuild;$http_moduleMagicNumber;$http_serverloaded;$http_compiledUsing:$http_Architecture;$http_ServerMPM;$http_threaded;$http_forked;$http_verboseCompile;$http_modules" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment