My name is Philipp C. Heckel and I write about nerdy things.

WP-UN: WordPress version update notification with cron

Administration, Linux, Scripting, Security

WP-UN: WordPress version update notification with cron

WordPress is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release.

As Debian/Ubuntu user, I am spoiled when it comes to update management: apt-get updates most of my software, and apticron notifies me when updates are available. For WordPress however, the packaged versions of Debian/Ubuntu are really old and less adjustable which unfortunately makes a manual installation inevitable. While there are several automated WordPress update mechanisms out there, I couldn’t find a simple notify-on-update tool.

This post introduces the WordPress Update Notifier (WP-UN), a simple script that frequently compares the installed WordPress version with the latest available one. If a new version is available, it sends an e-mail to a given address.



February ’11: I updated the script so that it now uses the WordPress API. If you want, you can still download the old version of WP-UN, but since changed their download mechanisms, it does not work any more.

1. Requirements

WP-UN is compatible with WordPress 2.5-3.x. It needs a local mail server such as Sendmail or Postfix to deliver the notification e-mail.

2. Download & Installation

Download the script, save it to your preferred location and make it executable:

That’s it for the installation. The script can now be called by simply running wp-un.

Download: WP-UN 0.2, February 2011
Old version: WP-UN 0.1, January 2010 (broken!)

3. Usage

Now you can call the script with the following arguments:

  • –test: to test if the notification works, use the –test parameter (optional).
  • INSTALL-DIR: the path to your local WordPress installation, for example /var/www/myblog.
  • NOTIFY-EMAIL: the e-mail address of the person to notify if a new WordPress version is available.

By default, the script is completely silent so that adding a cronjob doesn’t require output redirections. If, however, the –test option is given, it is more verbose and sends the notification e-mail in any case.

If a new WordPress version is available, the output looks something like this:

If WordPress is up-to-date, WP-UN would normally not send any notification. If, however, the –test option is enabled, it sends the e-mail no matter what. In this case, the output will look like this:

The notification you receive will look like this:

4. As cronjob

If you want to be notified as soon as a new version comes out, installing a cronjob is a good idea. Simply run crontab -e and add the following line to the file:

WP-UN will now run every morning at 6am and notify you if a new WordPress version is out there!

5. Conclusion

WP-UN is just one of many solutions and it’s only the work of one afternoon. However, it doesn’t need any additional software and keeps it simple. It serves its purpose and keeps my WordPress installation always up-to-date. If you have any suggestions or questions, feel free to comment below.

Comments are closed.