Wordpress installs multiply like bunnies. If you’ve got several WordPress domains hosted on a single server it’s easy to loose track of installed versions. This one-line wonder will sniff out WordPress powered sites and grab their version number. Drop it in a CRON that runs once a month and you’ll get regular reminders of what’s lurking out on your server.
WordPress installs contain the file version.php with the variable $wp_version. Find all the version.php files, grab the variable and you’re golden. Here’s the basic locate command:
That’s nice enough, but we can get a bit better. The server I’m targeting stores all virtual hosts in the directory /var/www/vhosts. We can use the cut command to snip that from the display, sort the output by domain name and email the results.
You’ll get an email with results like this:
For extra credit you could sort by version number, but there’s no need to be an overachiever here. Quit while you’re ahead. The script uses locate, so make sure you run updatedb periodically.