Friday 8 March 2013

Wordpress version finder bash script


This script can be used on cpanel servers.

#!/bin/bash
email=user@gmail.com # email where the reports are sent
hostname=`/bin/hostname`
find /home/*/public_html -iname version.php > /root/version.txt
grep "wp-includes" /root/version.txt > /root/version.txt1
for i in `cat /root/version.txt1`; do echo "Installed path=`echo $i|dirname $i|awk -Fwp {'print $1'}`" ; echo "Latest version = 3.3.1" ;echo
"Installed version = `grep "wp_version =" $i |cut -d '=' -f2`"; echo " "; done > /root/out.txt
mail $email -s"Wp-version report - $hostname" < /root/out.txt
rm -f /root/version.txt*
rm -f /root/out.txt