Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
Last active September 1, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vierbergenlars/7ab19c0a90171ed49535d3766279f918 to your computer and use it in GitHub Desktop.
Save vierbergenlars/7ab19c0a90171ed49535d3766279f918 to your computer and use it in GitHub Desktop.

Wordpress update checker

Install wp-cli as ~/bin/wp, and change $HOME/apps/wordpress-main to the location of your wordpress installation. Replace $USER with the email address to send the alert mail to (or not to deliver to the local user account) Add this line to your crontab (use crontab -e to change your contab)

0 0 * * 1 bash -c 'update_check=$($HOME/bin/wp core check-update --path=$HOME/apps/wordpress-main); if [[ ! "$update_check" =~ ^Success: ]]; then echo -e "Please update wordpress to the latest version.\n$update_check"| mail $USER -s "Wordpress update"; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment