Automating WordPress maintenancePublish date: 09 Mar 17
Tags: Automation WordPress
WordPress is an amazing blogging platform. However it does require a fair amount of love. Despite Mythic Beasts managing a large portion of my stack (hardware, OS, Apache, PHP, MySQL) and WordPress having automatic background updates I still find myself logging in and finding pending updates for WordPress.
The solution was WP-CLI. With the shell add-on, I SSH onto my account, then
What the above script does is download WP-CLI, grant it execute permission, then downloads my script and again, gives it execute permission.
Then its question of create a cron job using crontab, this can be done by running crontab -e then doing something like: (this runs the script every 15mins and redirects the output to a log file that gets overwrite each time it runs*)
overwrites the file. » Appends. I’ve not used append as I don’t want to deal with it growing and really I only want the last run details. Still your mileage may vary.
Below is the final script that executes WP-CLI