Day 14: HTMLy automatic backup system

Here I am again, trying on my own to code (and/or copy open source code) in order to generate things that could make life easier. After all, why were apps invented?

I’m currently using HTMLy for blogging. Although it has its own backup system, it’s not automatic (yet?). You have to click on a few links and then you can download the backup.

My system involves backing up the three main things that are usually updated in an HTMLy website: content, configuration, and themes. It backs up automatically and regularly at a pre-designated date and then sends the backup files to an assigned e-mail address right after.

For compressing the folder, I used Justin Erwell’s HZip and for e-mailing the compressed backup files, I’m using Mailgun.

In order for the following code to run regularly, you need to have access to crontab and schedule the code to run weekly or daily, depending on your needs.

Download code

Note: The commented lines explain what the code is for. I’ve tried a few other PHP codes to send the backup files via email but this one is the simplest to work with so far.

Now working on another system for automatically posting pre-scheduled posts on the blog. If this entry posts on December 12, 2016, I’ve successfully done the auto-schedule system! 😃