Snapshot Backup Plugin for WordPress

I’ve just finished writing a new WordPress Plugin which creates a Snapshot Backup of your entire website: that’s your Database, current WP Core, all your Themes, Plugins and Uploads. The resulting single archive file is then uploaded to an FTP repository of your choice.

Peace of mind included 😉

Download from the official WordPress Repository

UPDATE AUGUST 2012

Due to heavy workload and high demand I can currently no longer find the time to support Snapshot Backup. I may pick up this project again in the future and put new PHP skills to work. Thank you for being kind enough to understand.

In the meantime I’ve discovered a wonderful by Daniel Hüsken which does all I ever wanted Snapshot Backup to do and more: It’s called BackWPup – download it here. It’s way ahead of my plugin and under active development.

———————————-

Disclaimer

I’ve recently been flamed a lot by users who are less than happy with this plugin. That’s tough, so I wanted to state some very obvious facts that most of us do take for granted:

This plugin does not work for everyone. It works fine for me, and I’ve written it for me and my own servers. I’m distributing it in the hope that it will be useful to others, but with absolutely no guarantee that it will work on every Linux system out there.

You are free to use Snapshot Backup, but I strongly advise you to test it on a dummy system before deploying it to your precious live site. Users have reported every possible horror scenario, from complete site deletion to an empty database file. Please test the plugin on your system and check that it creates a reliable backup that can be restored before relying on it to work. Remember: you are using Snapshot Backup at your own risk.

Thank you!

Installation

Upload the ZIP file under Plugins – Add New – Upload. Alternatively, unzip all files and upload via FTP client manually.

Activate the plugin and find the option Snapshot Backup in your Dashboard options.

Usage

Snapshot Backup has been designed with ease of use and simplicity in mind.

Once the plugin is activated, you’ll find a new top Level Menu called Snapshot Backup on the left. Under Settings you configure your FTP Details and and additional directory you’d like to back up. Now you can either head over to to Snapshot Backup and create a Snapshot manually, or you can setup automation and let the plugin create a Snapshot for you at regular intervals.

Make sure your wp-content/uploads directory is writable – Snapshot Backup needs somewhere to write files to locally before they get sent away to your FTP server (this would ideally be a second server, preferably with a different host in a different data centre).

In the current release your screen will go blank while the script runs through the various stages. Depending on the size of your site this could take a while… be not alarmed and keep an eye out for the browser status bar. While it appears your browser is working Snapshot Backup is working too. I’m attempting to fix this in future releases and give you a status report of each stage.

Automation

Included since Version 2.0 we have the long awaited automation feature. This creates Snapshots while you sleep and even auto deletes older ones. You can set all this up under Automation and receive a friendly email ever time a Snapshot has been created (optional).

For the automation to work I’m using the WP Cron feature, which in turn relies on your website being visited every once in a while. On live production sites with 100+ visitors per day you’ll be fine, but on low traffic sites you may notice that Snapshots are created at irregular intervals – I’m thinking of test sites with blocked search engines or brand new sites.

To help this along and make the process more accurate you can create a Cron Job which calls the index.php file in your WordPress installation directory (usually http://www.yourdomain.com/index.php)

Screenshots

Snapshot Backup Admin Menu
Success Screen at the end of the Backup
FTP Details Dialogue. Don't panic, your password won't show up -it's an old screenshot you know.

Snapshot Philosophy

Archiving dynamic websites isn’t all that easy and we all tend to forget that because the web is such a fluid thing. The idea of Snapshot Backup is that you may want to create an “as is” version of your entire website for archive purposes. With each click you’ll create a “time capsule” of sorts – this could be for legal, sentimental or security reasons.

Other solutions mirror or sync your installation – which is a great idea too, however if you only notice a week down the line that your site has been compromised then your synced copy most certainly is too. Snapshot makes it easy to go back to a clean version from x days/weeks/months ago.

How does it work?

Snapshot Backup first reads out your entire database into an file. Afterwards it uses the Linux shell command tar to archive all your content. Then it deletes the SQL file and then it uploads the resulting archive file over to your FTP repository.

Please note that this plugin does not work on Windows servers… sorry ;-(

Restoring a Snapshot

I’m working on a simple script that will do this for you. In the meantime you’ll be on your own – with some written guidance from yours truly. Have a look at this article which explains how to restore via FTP.

Known Issues

Even though this plugin is a great idea, it may not work for everyone. I’ve had reports from users reporting that either the plugin creates a 0MB backup file or does not include the database in the tar ball. The following hosts are known to be problematic:

  • Media Temple
  • Netpower
  • MyWebHost
  • Momwebs
On the other hand, on most hosts this plugin works just fine. If you are in the unlucky situation that you have a problem, please leave a comment and state your web host so I can add to this list.

Alternatives to Snapshot Backup

There are alternatives to creating a full backup of your site such as these (which will cost money):
Or you can try the excellent WP DB Backup Plugin which will read out your database. Following that you can simply login to your site via FTP and copy all your files to your local machine. Not pretty, not automatic, not fast, not convenient… but it’s free and it works 😉

Roadmap: The Future of Snapshot Backup

There are plenty of things I want to add to and improve on this plugin:

  • make sure the screen doesn’t go blank while the Snapshot is being created
  • add translation
  • add the ability to run Snapshot automatically via WP Cron or Cron Jobs done since 2.0
  • make the admin interface look prettier (and easier to find) done since 2.0
  • manage FTP repository from admin interface (i.e. list and delete older backups, local and FTP)
  • give this plugin its own website for documentation (snapshotbackup.org)
  • finalize Snapshot Restore script
  • add FTP Port selection done since 2.1
  • add cloud storage support (Amazon, Dropbox, etc)

If you have any suggestions for future features please leave a comment.

Enjoy Snapshot Backup responsibly 😉

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

215 thoughts on “Snapshot Backup Plugin for WordPress

  1. It does not appear the the DB file is included in the archive and gets left in the uploads directory. Additionally, the content folder does not seem to be backed up. I host with godaddy.com

    Not sure how to restore the backup to test if it works.

  2. Hi, looks like SnapShot Backup is working OK for me so far 🙂 I’m with DreamHost.
    Please consider these Feature Requests:
    * Add ZIP option after tar.
    * save DB dump file to FTP server separately, instead of hiding in uploads folder.

    Thanks! 🙂

    1. Hi Dave,

      that is really good to hear, thanks for letting me know! I’ll certainly look into having the SQL as a separate file, at least have the option to switch this on in the menu somewhere. Not sure about zipping the TAR file though, since the TAR is already compressed with GZip – so you’d have to uncompress it twice. I’m a big fan of “easy and straightforward things” – let me think about it.

      1. Well, no need for double compression! tar is fine. I just didn’t want to spend more time than necessary to download the backup tar file.

        It is also OK to save the sql dump into that tar file, just not ideal to bury it so deep. But it is working, so I can’t really complain. 🙂

  3. Awesome – great plugin. Just deployed to a few blogs I manage – works perfectly (I host with HostGator). Thanks! 🙂

  4. Thanks for the plugin that works fine (comparing to others)
    It would be great to gzip tars to save traffic – my site is 1,3 Gb now…

    1. No problem, glad to hear it’s working for you. I hear what you’re saying about the GZIP option. I’ve done some testing on that front and – believe it or not – the GZIP after TAR creates a file with the same size as the TAR or larger. Bizarre, but I guess these effects can happen with compression sometimes.

      I was thinking maybe I can integrate this as an option, and GZIP both the TAR and the SQL as two files together, therefore the SQL file is easier to find. I hope I’ll get some time over the next couple of months to start working on Snapshot again, life’s pretty busy at the moment.

  5. Hey, nice plugin.
    I only have one small problem . I don’t remember if it appeared after updating wordpress or another plugin, but somehow if i have a limit of snapshots on the FTP server, your plugin transfers the last snapshot created and then deletes it ( i can see this in the FTP logs). It should delete the oldest snapshot right ?
    I’ve checked the names of the snapshots, and they are in chronological order. I’ve deleted all the snapshots in the remtote FTP folder, but it still deleting the snapshot that it just transferred.
    I am running wordpress 3.3.1 and snapshot 2.0.2.
    The remote server is running PureFTPd on Ubuntu 11.10 x64.

    1. Hi there,

      thank you for letting me know – yes it *should* delete the oldest snapshot file… I’ve run a test at my end just now and can confirm it doesn’t do what we expect. I’m on CentOS with ProFTP at my end.

      I’ll see if I can fix it – sadly I’m too occupied with other projects right now so it could take a while. Watch out for an upgrade which will address this issue. There are some other major upgrades I want to undertake so this is one is getting priority. Thanks!

  6. Awesome plugin! been using it for months. Today, however, I was trying to set it up on one of my other websites, and while doing that, I changed my FTP user password.
    Since that moment, the FTP server would always reject the connection (unknown username and password), when coming from the plugin.
    I’m able to connect with the same credentials, using Cyberduck, as well as FTP’ing from my webhost server (via an SSH session) without a problem. So, I know it’s not an issue with the FTP server. Has there been any changes that you can think of that may be causing this?
    btw, I’m running FileZilla FTP Server.

    1. Hi George,

      Glad you like the plugin! I’ve not made any changes to it recently, in fact it’s been like it is for too long. Strange thing you’ve got there… Is it not working anymore on any of your sites?

      Sometimes when you paste your password rather than typing it in the plugin may see an extra character at the end (like a space). Also, are there any symbols in your new password? See if it works with only alphanumeric characters (no symbols).

      Let me know if any of this helps.

  7. Hi

    Been using Snapshot Backup for a while and really love it. But I have a problem though – even though Snapshot Backup makes a backupfile of 3.5 GB, it only uploads around 1.3 GB to the FTP-server – consistently. Any idea why this happens?

    R.

    1. Hi Ronni,

      thanks for bringing this to my attention – sounds like an FTP timeout or limitation to me. I’ve not tested the plugin with files that size. I’ll investigate this.

      Let me ask you something: have you noticed anything like the plugin slowing down your website? I’ve had reports from other users about this but can’t see anything at my end. Are you on a dedicated machine or on shared hosting?

      1. I’m pretty sure it’s an FTP-timeout then, as I experience the same thing when uploading / downloading to the same server. Unfortunately it’s a shared (discount)-host, so there’s no way of getting that fixed.

        Bummer – I had hoped it was something I could change manually. Oh well – Snapshot Backup still works – I just have to download the backup manually with a FTP-program that supports resume.

        Regarding slowdown: Yes, when starting the backup the server is somewhat slower, but that only lasts for very few minutes. The FTP-transfer is not noticable at all.

        R.

        1. Thanks for letting me know, Ronni.

          I’m looking into other storage options, such as Amazon AWS and DropBox, but that’s a bit in the future. Maybe those won’t time out so easily.

  8. Man I am really glad I use SNAPSHOT BACKUP and saved the backup file elsewhere via ftp.

    Today someone and their MS FrontPage wiped out a whole WP site, and the website folder above it. If I had been saving WP backups in the WP folder (as many so-called backup plug ins do), they would be gone too. Luckily, I used SnapShot Backup and went to the extra trouble to create an additional ftp user just for wordpress backups.

    So when this guy accidentally erased the whole WP site folder, it was no problem because he didn’t have access to the backups (so they were safe). I had the whole thing back up & running in less then 30 minutes, and I can do it faster next time. I have to say I’m quite pleased.

    Mucho Thanks Jay Versluis!
    You really helped save the day!

  9. Hi

    Thanks for the new update. Really nice to see that this great update is continually progressing.

    One problem, that also existed in the previous version. When selecting to see all backups, I get the following error:

    Warning: Invalid argument supplied for foreach() in /mounted-storage/home71a/sub009/sc41273-MYEA/noeddeskallen.dk/wp-content/plugins/snapshot-backup/includes/check-repo.php on line 60

    Any idea?

    1. Hi Ronni,

      glad you like it 😉 Let’s see if we can fix your issue. Looking at the code I bet the ftp_nlist() command didn’t work properly. I need to have a look at the output of that command. Have a look at the following file in a text editor: snapshot-backup/includes/check-repo.php

      Line 60 reports the problem, but just above that there are these two lines of code:

      // output $contents
      // var_dump($contents);

      Uncomment the second line (i.e. remove //), save/upload the file and go to the List Snapshots section again. Let me know what you see.

      1. I get the following error:

        Parse error: syntax error, unexpected T_VARIABLE in /mounted-storage/home71a/sub009/sc41273-MYEA/noeddeskallen.dk/wp-content/plugins/snapshot-backup/includes/check-repo.php on line 55

        By the way – even if I have chosen to maintain the last 10 backups, is seems like only the new one is kept – the rest is deleted.

        R.

        1. Bizarre stuff, it leaves me clueless I’m afraid. On my setup (CentOS 6) it just lists the files. What server configuration are you using?

          This is related to the auto delete function not working properly on your system, they read out the files in the same way. I bet the same error happens when the automation runs the auto delete function.

          You can switch auto deletion off in this version by using a value greater than 100 – let me know if it works.

Comments are closed.