As usual with any IT system backups are important. This does not change when using a free shared hosting provider. Because it is free, one would argue it is even more important.
For my wordpress web site I used something called cli-exporter. It let's you create "Wordpress" export files from the command line so it can be run from
cron. This is important because backups have to be automated.
In addition to that, I copy the backup files to an off-site location. I do this by copying files using WebDAV to a storage provider. I did this by writing a simple script and using the PHP library SabreDAV which makes writing DAV clients quite easy.
I myself don't mind using other people's Open Source code to do something. I was actually surprised that I was not able to find something that meet my criteria. However, thanks to the power of open source I was able to find something that fit the bill exactly.
To make things more interesting, because I wanted to keep backup files as compressed Zip archives, my backup scripts did not work in one of the web hosts that I was using. They did not have the
zip extensions enabled. This is surprising considering is quite standard. Luckily I was able to find a pure PHP library pclzip.