Automatic WordPress Updates on NearlyFreeSpeech.Net🗓
I've recently decided to switch my hosting over to NearlyFreeSpeech.Net (NSFN) to lower my hosting costs on sites (such as this one!) that I mostly just run for fun. Judging by the cost calculator, the traffic I get currently, and my use of CloudFlare I should be able to get away with just a few bucks a month. (Though this is yet to be confirmed!).
By default NSFN has some really strict permissions on your file system - which while great for security it does create a little bit of weirdness with some features you might otherwise just expect to work -- such as WordPress' automatic update features. I did some poking around online to see what others recommended for fixing this and quickly found a lot of posts suggesting you should modify your permissions to allow easier read/writing on the wp-content/plugins folder or to add your FTP creds into your wp-config file.
Personally I don't like the idea of doing either of those options - especially the former. Ultimately I decided to make use of the "Scheduled Actions" cron-like feature on NSFN to run WP updates once a day via WP-CLI and so far it's been working pretty great.
To accomplish this you'll find need to login to your NSFN account and select Sites from the top navigation and select your Shortname from the list below:
From there, take a peek to the right under "Actions" and you'll find "Manage Scheduled Tasks":
Once inside of this screen select "Add a Scheduled Task" and configure it as follows depending on what type of automatic updates you wish to have process.
All of these assume you use the default directory /home/public for your accounts on NSFN. If you have not gone out of your way to change this you'll be just fine.
That's it! Each of those processes will run daily and you'll be emailed each time they run to confirm success or failure. If you'd rather combine these all into one scheduled command you can also make use of "&&" between each and they'll run accordingly. Personally I like to break them up and put an hour between each process -- just because I run on the paranoid side.
That's it! That's all there is to it. Now you can have your strict permissions and daily updates for WordPress on NFSN as well.
The best of both worlds. 😎
PS - If you're trying to setup WordPress on NSFN I would recommend following the tutorial they provide.———