Setting Up A Website Backup System Using An Owncloud Server

And Why QuadraNet Sucks.
Setting Up A Website Backup System Using An Owncloud Server

Background

Have you noticed one or two missing posts here, and very low resolution pictures? I used to have a really cheap VPS from Crissic, great guys, 2 core 512mb ram VPSs for U$ 12.00 a YEAR!

But some time ago they were acquired by QuadraNet, and boy, do they suck.

The were being updated by mail, and I got worried and made a backup, and the last e-mail I got from them contained this:

alt text

I did a backup of the database during the proccess, but this message made me stop worrying. I had to finish my semester, and after December 10th I would be able to care of these issues(I still had around 4 or 5 months of contract. Then, at December 4th, eveything goes offline.

They claim they sent another email, November 4th, warning about the cancelation of all services. I never got it.

They didn't reply any tickets, except for refunds. and there was no way to recover any data.

The solution

Bottomline, I should have better, regular, and broader backups. Now on a new VPS, I needed a simple but reliable backup system, but, hey, we already setup owncloud there, I can just zip(or tar, I know) the files and add to a folder of my user, add a cron script, and have regular backups on my machine!.

I setup the cron on the sudo user, because it needs permission for both the Owncloud folder(under www-data) and my blog(under my user):

10 2 * * *   zip -r /var/www/owncloud/data/will/files/sitebackup/$(date +'\%Y\%m\%d').zip 
/path_to_my_blog/ 
&& chown www-data:www-data /var/www/owncloud/data/will/files/sitebackup -R 
&& sudo -u www-data /var/www/owncloud/occ files:scan --all > /var/log/cronlog

There are 3 commands on the chain:

  1. Compress all the files and place the file on the owncloud folder.
  2. Change new file ownership to www-data
  3. Force OWncloud to re-scan the files server-side.