OmicronLab Posted April 7, 2007 Posted April 7, 2007 (edited) Backup your whole website in zip format, get it via mail! Who doesn't know how important it is to backup your site/blog often? Again, if you use dynamic sites such as Joomla or a forum (e.g. IPB), there is always a risk to be hacked, no matter how security concern you are! In my experience, it is not always easy to regularly maintain backups, especially, if you don't have a good internet connection. What if your site prepare backups for you and send it automatically to your inbox (Gmail, perhaps)? This script do the same: > Backup your whole website/blog by compressing it in zip format > Split the zip files to smaller size so that you can easily get them via mail. (Gmail doesn't allow attachments more than 10 MB, this splitting solves this problem) > Send backup files to you via mail! Without relying to basic PHP Mail, this script send mail via SMTP (authentication supported), which is much more powerful. In our test run, it could send 250 MB backup file in small 9 MB pieces each to a GMail account! Credits: This script is written by Mehdi Hasan (Me ). http://www.omicronlab.com/ Swift SMTP mailer library is taken from http://www.swiftmailer.org/ Download from here: backup.zip (Installation instructions are included in the zip file.) Edited April 7, 2007 by OmicronLab Quote
jayson Posted April 7, 2007 Posted April 7, 2007 Just a question before I look at it, will it merge the files back together, my site is 250 megs, can I get the files and then merge all the parts back to one file? Quote
TCH-Andy Posted April 7, 2007 Posted April 7, 2007 Thanks for the copy. You've added a few more features to our version Backing up your account, which is great, backing up your account is something everyone should do. A few comments. 1. The Swift library has the GNU Lesser GPL (which is great - I'm a large fan of open source software), but it includes; 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. So you should include a copy of the license with the files in your zip. 2. You suggest; " Set permission to $zippath directory to 777. On above code, the directory is: /home/username/public_html/backup/tmp" I would personally suggest that you place the zip path outside the public_html such as /home/username/backup/tmp. Your main backup file should go here as well (you don't really want others backing up your account by going to that URL). 3. You talk about dynamic sites, where it's even more important to backup the dynamic data (the database) which your script doesn't include. Can I suggest that be added as an option ? it would only mean adding a few lines of code to the existing code. Quote
OmicronLab Posted April 7, 2007 Author Posted April 7, 2007 Thanks Andy, here is my reply: ... So you should include a copy of the license with the files in your zip. I'm not a license expert, that was the fault. Updated te zip file with license information. Thanks again 2. You suggest; " Set permission to $zippath directory to 777. On above code, the directory is: /home/username/public_html/backup/tmp" I would personally suggest that you place the zip path outside the public_html such as /home/username/backup/tmp. Your main backup file should go here as well (you don't really want others backing up your account by going to that URL). I've added this note in the Readme.html file, probably you haven't noticed. I never used any Control panel other than CPanel, so I didn't write how to set up a cronjob. But I indeed recommended it. Have a look: Important: For security reasons, keep this script outside public_html directory and run via cronjob. If you don't know how to set up a cronjob, ask your host. Or, if you want to run this script through your browser, password protect the directory where the script is present. 3. You talk about dynamic sites, where it's even more important to backup the dynamic data (the database) which your script doesn't include. Can I suggest that be added as an option ? it would only mean adding a few lines of code to the existing code. Thanks for the suggestion! Personally I use dbsender (Reffered in this post: Backup FAQ). I'm going to add database support now, it should take a few hours to update Quote
OmicronLab Posted April 7, 2007 Author Posted April 7, 2007 Just a question before I look at it, will it merge the files back together, my site is 250 megs, can I get the files and then merge all the parts back to one file? It will not merge any file, just pack the files and send to you. In fact, there is no need to merge. Every splitted and sent zip files are separate units. You can extract them with ANY zip/unzip utility (such as Winzip or Winrar). Extract all the zip files in a single folder, and upload them if you wish to restore your backup. It is that easy Quote
OmicronLab Posted April 7, 2007 Author Posted April 7, 2007 I have updated the script. Now it can send database backup also (optional) Quote
OmicronLab Posted April 8, 2007 Author Posted April 8, 2007 I've updated the script, in previous script some users faced problem on sending multiple mails with one SMTP session. What's new: 1. Connect to SMTP server each time before sending mail 2. SMTP authentication is now optional (not every server needs authentication) 3. Some informative error messages added. (The updated script can be downloaded from the same location mentioned in the 1st post of this thread) Quote
jayson Posted April 15, 2007 Posted April 15, 2007 I having a little problem, I followed the instructions and did all that it told me to do, but this is what I get as an error: Zipping Directory: /home/domain.com/public_html Server failed to zip /home/domain.com/public_html! Hint: Make sure /home/domain.com/public_html/tmp directory is CHOMD 777 and /home/domain.com/public_html path exists. Quiting... the CHOMD is set to 777, not sure what I am doing wrong. Quote
TCH-Bruce Posted April 15, 2007 Posted April 15, 2007 It should not be /home/domain.com it should be /home/cpanelname Quote
jayson Posted April 15, 2007 Posted April 15, 2007 OPk that worked great. now another problem, this is what I have for the mail server $mailserver = 'mail.domain.com'; //SMTP server address $mailserver_need_authentication='yes'; //Use username & password for sending mail? 'yes' or 'no' $smtpusername = 'cpanelname'; //SMTP server username $smtppassword = 'cpanelpassword'; //SMTP server password $to = 'email@gmail.com';// Who should the emails be sent from? But it has been an hour and a half and still no email, this is the message I recieved": Zipping Directory: /home/cpanelname/public_html Estimated number of splitted files: 24 Splitting zip file: /home/cpanelname/public_html/tmp/jsabackup.zip Starting Sending Mails ... ... ... Finish Sending all mails! Check your inbox but no email... Quote
TCH-Bruce Posted April 16, 2007 Posted April 16, 2007 I have not tested this script but if I were setting it up I would do this. $mailserver = 'mail.domain.com'; //SMTP server address $mailserver_need_authentication='yes'; //Use username & password for sending mail? 'yes' or 'no' $smtpusername = 'valid-domain-email-address'; //SMTP valid domain email address $smtppassword = 'password-for-valid-email'; //SMTP password $to = 'email@gmail.com';// Who should the emails be sent from? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.