0

I run a lot of local business websites, a lot of them are on external, cheap servers (limited transfer, limited script execution time etc.) and owners refuse to pay a lot of money for a proper backup.

From time to time, there is a request like "I clicked something, now it's not working, fix it please". Last backup I have is ex. 1 month old.

What I'm looking for is a solution can:

  • backup files from many FTPs (including .php files)
  • do it incrementally from FTP (without downloading all files as
    servers have transfer limits)
  • backup databases
  • store backup for a desired period of time
  • is not based on syncing files (so some failure can't be synced to my computer)

Obvious solutions like gzip all the files and send it to external server are too much for these servers.

What I'm trying to achieve is not a 100% disaster proof solution, rather something that speeds up the recovery when somebody "clicks something when adding new gallery".

OS: Windows or Linux (preferably)

Do you know something that fit my needs?

10
  • What type of CMS....Drupal? Joomla? etc. – rrirower Jan 29 '16 at 13:42
  • 1
    Generally Wordpress - sometimes Wordpress with Woocommerce, but it would be great to avoid CMS specific solution – pp_1 Jan 29 '16 at 13:46
  • Some CMS (e.g. Drupal) provide modules to backup your site. I've also used the scheduled backup provided by a hosting site. But, that doesn't sound like a possibility for you. – rrirower Jan 29 '16 at 13:49
  • For Wordpress wp-clone works quite well. These servers have ex. 20sec script execution time, so you won't backup 500MB of files in this time - backup fails. – pp_1 Jan 29 '16 at 13:52
  • 3
    Do those hosts provide something like Git or SVN? In that case you could simply schedule a DB dump, and do a regular commit via Cron – no extra software needed. – Izzy Jan 29 '16 at 13:53
2

As a lot of providers provide version control utilities on their hosts (your own words), you might need no special software in addition to what's already there:

  • set up a cron job to dump database contents. For MySQL databases, it's e.g. the mysqldump utility saving all your databases into text files, which would be very convenient here
  • set up a repository (or two) with the version control system, pointing the working directories to your web root and the place of your database dumps
  • let the cron job do a commit in both places when the database export is done
  • let the cron job remove your DB dump at the end (or at least take other precautions e.g. by file permissions). Especially take care to not have those files inside your web tree, for obvious reasons (content, passwords, configurations) (thanks to gabe3886 for pointing out what I've missed to mention ;)

Now, if you need to restore, you can simply pick the file(s) to restore from the repository. For the database, you could either restore it back to that point – or import the backup to a separate database and pick the tables/records you need.

3
  • 1
    I'd say this is a good idea with one caveat, don't leave the database files within the working directories once committed. If people guess or find out the names of them, they could go to them directly and download all of the data. – gabe3886 Jan 29 '16 at 14:57
  • @gabe3886 how could I miss to point that out! Must have been too obvious a thing :) Thanks, added that to my answer (with credits to you). – Izzy Jan 29 '16 at 15:29
  • 1
    when it comes to security nothing is ever too obvious, sadly – gabe3886 Jan 29 '16 at 16:09
1

Since you mentioned that "owners refuse to pay a lot of money", Are they are willing to pay "some money"?

If yes, Codeguard is one solution that could fit your requirement.

It backup incrementally, only transfer files when there are changes. It also backup MySQL database. You can go back in time to download specific file.

The basic plan is $5/month. There are many hosting companies that offer it at discount. If your hosting company has deal, it may cost even less and the backup can be activated in cpanel directly. Fast as easy.

1
  • Well, what I really should write was "they refuse to pay until something breaks up. Then they pay me to fix it 10 times more than a backup would cost"... I'll look into Codeguard, thanks. – pp_1 Feb 1 '16 at 12:29
0

I did some tests and @Izzy's solution, which was very promising, unfortunately isn't the best, for below reasons:

  • crons: I was surprised how many "the most cheapest" hostings don't have it,
  • version control: a lot of them doesn't support it.

I said lots of them support it, and while it's true it's not enough as some of them don't. I was trying to work it around, but it was getting overly complex and complicated. As every single hosting provides a SQL database and FTP access, I finally sat down and wrote a simple bash script to do the backing up: https://github.com/pp-1/backuper

It's my first bash script, so the code isn't very good, but it does what I need. Feel free to use it, modify or whatever you want.

The idea is very simple: I have always-on home computer and a decent internet connection. I created a Debian VM on it and added cron to start backup every month.

Script configuration and how it works is described in the repo's readme.

Current version has some bugs, the biggest are:

  • efficiency: copying a lot of small files isn't very fast
  • security: website's access data are in plain text
  • error reporting: well, there is none.

Disclaimer: remember what this script is designed to do: backup websites for custumers who are not willing to pay for it, just for my own comfort to fix their websites faster if they break it. It's not designed to be bulletproof and it's not. It not very trustworthy (ex. it won't resume after crash or power outage).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.