Snapshot Backup Plugin for WordPress

by Jay Versluis on February 19, 2011

in Plugins, Snapshot Backup Devlog

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 ;-)

{ 211 comments… read them below or add one }

Michael September 1, 2011 at 2:27 pm

I tried this plugin:
http://austinmatzko.com/wordpress-plugins/wp-db-backup/
for the database only and it works, but i dont know which method it uses, maybe you can look inside and can see the difference. Will a phpinfo of my host help to see if mysqldump works?

Reply

Jay Versluis September 1, 2011 at 2:43 pm

I know that plugin well, it uses PHP to read out the database. It’s rather complex to dissect – I’ll give it a go sometime in the future, watch this space!

An earlier version of Snapshot Backup used a PHP script to readout the database, but it didn’t play well with some hosts so I’ve changed it to mysqldump (which is a Linux shell command).

Reply

Michael September 1, 2011 at 3:11 pm

Its just an idea, i dont know if many people have the same problem like me. Maybe if some others have it you could let the user choose a second sql generation method which integrates the other plugin and used its procedures?

Reply

Jay Versluis September 18, 2011 at 9:15 pm

I’ll see what I can do in a future release.

Reply

Carsten September 7, 2011 at 1:48 pm

Hi

I can see you plan to add an ftp port option, i look forward to that :)

I use a different port than 21, way too many hackers trying to brute force their way into the server all day long.

Reply

Jay Versluis September 18, 2011 at 9:16 pm

It’s on my list of future improvements – finding time for those is currently the bigger issue ;-)

Reply

James September 14, 2011 at 6:29 pm

I use this plugin regularly, and it successfully makes the backup on my server, but every time I try to download a copy of the snapshot, It gets interrupted at 4.0MB. If I use wget, this is what happens: “Read error at byte 4244253/47482880 (Connection reset by peer). Retrying.”

It then resumes and gets the rest of the file.

Reply

Jay Versluis September 18, 2011 at 9:14 pm

Hi James,

Sounds like a server issue to me. Can you download other files from your server that are larger than 4MB?

Reply

Richard September 21, 2011 at 10:52 pm

Hi, great plugin and it seems to work for me with everything but FTP, I have it set up correctly in that the plugin tells me that everything is good with my FTP and I can connect and use it through an FTP client, however when I run a snapshot I get the error “Error: Could not upload file. This will be local backup.”

Anyone have any ideas please?

Thanks

Richard

Reply

Jay Versluis September 22, 2011 at 12:13 pm

Bizarre I say!

Could you email me those FTP details to support@wphosting.tv? Sounds like a puzzle I’m happy to investigate. Alternatively you can use the contact section on this site.

Reply

Richard September 22, 2011 at 5:42 pm

Thanks for your prompt reply by email, I have managed to resolve the problem myself, I was not entering the initial remote directory in the FTP settings correctly.

Thanks again for your help.

Richard

Reply

Jay Versluis September 22, 2011 at 7:07 pm

Glad to hear it works now ;-)

Reply

Pat Coleman September 23, 2011 at 12:54 am

Hey Jay,

I have a GoDaddy.com hosted site. I successfully installed and ran your script. It created a .tar file of 13.1Mb. When I try to download it to my local machine it appears that the files endlessly grows in size. Essentially, it never completes downloading – when it get’s to 100% it keeps going and going. I finally stopped it at 130% and then tried it again and again with the same result.

Hope you can help.

Pat

Reply

Jay Versluis September 23, 2011 at 9:14 am

Hello Pat,

This sounds like a local download issue rather than a plugin problem. Could you provide a link to your snapshot file? I’ll see what happens at my end.

Reply

Dane Mentzer September 25, 2011 at 4:52 am

I was just made aware by Bluehost.com that my site was causing 100+ backend jobs to be processed and was bogging down the entire system. They shut down my hosting. When I called in, they said Snapshot was the culprit. I convinced them to reactivate it and I deactivated the plugin. Now we’re fine. Just letting you know.

Reply

Jay Versluis September 25, 2011 at 1:34 pm

Thank you for your feedback, Dane.

It would be interesting to know if you used the automatic backup feature and if so with which frequency. For example, if you asked for a backup every two minutes for several days then yes – it will bog down busy servers. On the other hand, one backup per day shouldn’t be a problem.

Reply

glenneroo February 15, 2012 at 3:47 pm

Similar situation here with World4You and WP 3.1 – and yes I have verified that automation is disabled. It seems to be stuck in a loop continuously creating 1.3GB archive files (we only have 5GB total available, i.e. after 1 backup the 2nd one can’t be created and there appears the next one with 0 bytes until I delete the 1.3GB one). I keep my FTP program open to the /backup directory and I notice a new file appears every 30-60 minutes with the current date/time stamp. What is going on?! :(

Reply

Jay Versluis February 16, 2012 at 4:27 pm

Hi glenroo,

thanks for letting me know – I’ll have a look into this. I think WordPress 3.1 has introduced something that the plugin doesn’t like, and my plugin is due for a major overhaul anyway. I think I’ll get a chance to look into this next week – watch out for an upgrade.

Reply

sam December 20, 2011 at 9:12 pm

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.

Reply

Jay Versluis December 23, 2011 at 5:29 am

Hi Sam,

just checking is your content folder in the default location or did you move it? Did you tell Snapshot Backup about it under Settings?

Reply

Dave January 10, 2012 at 8:42 am

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! :-)

Reply

Jay Versluis January 11, 2012 at 12:02 pm

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.

Reply

Dave Nathanson February 28, 2012 at 2:43 am

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. :-)

Reply

dave January 11, 2012 at 9:29 pm

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

Reply

Jay Versluis January 18, 2012 at 4:48 pm

Great to hear, thank you for your feedback!

Reply

Leave a Comment


Notify me of followup comments via e-mail. You can also subscribe without commenting.

{ 4 trackbacks }

Previous post:

Next post: