100 Web Space
http://forum.100webspace.com/

Save yourself - Backup your files
http://forum.100webspace.com/viewtopic.php?f=4&t=1350
Page 1 of 1

Author:  bobg [ Sat May 07, 2005 2:57 am ]
Post subject:  Save yourself - Backup your files

Thought I would pass this backup script for you all to use so you can save yourself a lot of headaches.

First, create a new directory called system_backup with permissions of 777

Next, edit the script to reflect the absolute paths to the root of your site and the absolute path to the system_backup directory, a script is included to get the absolute path if you need it.

Replace the ????????'s with the absolute path, save it.

The script I call backup.php
Code:
<?php
/*
  $Id: sysbackup.php,v1.0a 2005/01/02 01:53:52 hpdl Exp $

  Released under the GNU General Public License
*/
         $backupdate = date("Ymd_H-i-s");
         //Backup date variable. Replace "Ymd" with
         //"Ymd_H-i-s" to include the time.

         $backupdir = "/home/www/?????????.com";
         //Change to the absolute path to your website
         
         $files = "*";
         //What file to backup? Use a * to backup all the files
         //inside the folder entered above.
         
         $backupto = "/home/www/???????????/system_backup";
         //Change to the absolute path to your system_backup directory

         $fileprefix = "bak";
         //This is the prefix that will be added before the date:
         //(bak_20040326.tar)
         //The underscore _ is added automatically

         $tararg = "-cf";
         //Here goes the tar arguments. I recommend -cf.
         //c is for compressing. f is for outputting
         //a file.

         $bz2arg = "-z9";
         //Here goes the bunzip2 arguments. I recommend -z9.
         //z is for creating a archive
         //and 9 is for max compression. z is always needed

//Call the function
backupsus();
         
function backupsus() {
       global $backupdate,$backupdir,$backupto,
       $fileprefix,$tararg,$files;
$backupsuscmd = "cd $backupdir;
    tar $tararg {$fileprefix}_{$backupdate}.tar $files;
    bunzip2 $bz2arg {$fileprefix}_{$backupdate}.tar;
    mv {$fileprefix}_{$backupdate}.tar $backupto";
   passthru ("$backupsuscmd");
}
?>
<?php
function directory($result) {
   
    $handle=opendir("./system_backup");
    while ($file = readdir($handle)) {
    if ($file == "." || $file == "..") { } else { print "<a href=system_backup/$file>$file</a><br>\n"; }
     
    }
    closedir($handle);

return $result;
}
?>
<b>Your System Backup is now complete! FTP the backup file to your PC for safe keeping and delete it from the server to save space.</b>
<p>


FTP the script to the root of your website, to execute it just point your browser to backup.php (http://www.?????.com/backup.php). Depending on how large your site is it may run just a few seconds or a few minutes.

Remember to FTP the .tar file to your PC and delete it from your webspace to save space.

Not sure of the absolute path? Here is a short script the will tell you:

abspath.php

Code:
<?php
/*
  $Id: abspath.php,BETA 2005/01/02 01:56:52 hpdl Exp $

   Released under the GNU General Public License
*/
echo getcwd();
?>


Copy and paste it into notepad, save it as abspath.php and FTP to to the root of your website, point your browser to it and it will display.

This script should work for everyone and I use it on a weekly basis on two websites I host here.

Hope this helps,

Bob G.

Author:  bonelifer [ Sat May 07, 2005 3:53 am ]
Post subject: 

Did you write those scripts? Instead of saying what files you want to include, would it be possible to add a way exclude certain files/directories by name?

Thanks for the files. It a lot easier to download one archive than to download each seperately.

Author:  =cipher= [ Sat May 07, 2005 12:21 pm ]
Post subject: 

That is a very nice script. May I have permission to put it on my site for a download?

Author:  bobg [ Sat May 07, 2005 1:36 pm ]
Post subject: 

bonelifer wrote:
Did you write those scripts? Instead of saying what files you want to include, would it be possible to add a way exclude certain files/directories by name?

Thanks for the files. It a lot easier to download one archive than to download each seperately.


Thanks, the script was written for me by a co-worker a long time ago, unfortunatly, we no longer work together but I'm sure that if someone wanted to they could adapt it to include or exclude files or directories.

Author:  bobg [ Sat May 07, 2005 1:37 pm ]
Post subject: 

=cipher= wrote:
That is a very nice script. May I have permission to put it on my site for a download?


Sure, no problem.

Author:  bobg [ Sat May 07, 2005 5:28 pm ]
Post subject: 

For anyone not on a free account and not restricted by the 500k file size limit, there is a way to download the backup file to your PC without using FTP.

Find:
Code:
<b>Your System Backup is now complete! FTP the backup file to your PC for safe keeping and delete it from the server to save space.</b>
<p>


Replace with:
Code:
<b>Your System Backup is now complete! Select the backup version you want to save from the list below:</b>
<p>
<?php
echo directory($result);
?>


This will create a hyperlink to allow you to download the backup.

Bob G.

Author:  bonelifer [ Thu Aug 25, 2005 9:02 am ]
Post subject: 

This should really be a STICKY.

Author:  rm249 [ Thu Aug 25, 2005 8:00 pm ]
Post subject: 

Stickied :D

Author:  Dale [ Sat Dec 24, 2005 2:44 pm ]
Post subject: 

Nice script bobg!..Saved my life hundreds of times :p

Author:  rm249 [ Sat Dec 31, 2005 3:31 am ]
Post subject: 

I could imagine that my backup file would get pretty big with all of my games and stuff on my site.... will have to try though... not like i am using more than 20% of my 2.5GB space lol :)

Author:  jaygreentree [ Tue Jan 03, 2006 9:27 pm ]
Post subject: 

does this script work if PHP's Safe Mode is enabled? I have tried to get it to work on my cPanel server that has Safe Mode enabled and nothing happens. The server administrator said something about:

Quote:
if you "nice" the bzip2 command, you can run it once a week. However, keep in mind that this script serves the same purpose as cPanel's own backup utility.


How can I do this?

Author:  bobg [ Tue Jan 03, 2006 11:56 pm ]
Post subject: 

I'm not sure, I do know it works on these servers. When I look at the php.ini file in EasyPHP, here is what it says about Safe Mode.

Quote:
; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
safe_mode_gid = Off

; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
safe_mode_include_dir =

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir =

Author:  White Raven [ Tue Jan 31, 2006 8:19 pm ]
Post subject:  dummy instructions for this?

Dumb question...
I've never used FTP but am looking for an easy way to back up my site.
Any chance someone could give me a more detailed set of instructions to go with this? Or another easy way to back up an entire site?

Thanks,

Raven

Author:  Oliver [ Thu Feb 02, 2006 5:39 am ]
Post subject: 

Easiest way to backup the entire site is via FTP. First you need an FTP client - this is the program that you use to connect via FTP. I recommend FileZilla (here is a download link: http://prdownloads.sourceforge.net/file ... r=easynews) - it is free too. So once you have installed FileZilla you need the following settings in order to connect:
FTP host: /your domain/subdomain name/
username: /your account's username/
password: /you FTP password/
Note that the FTP password is the one set in the FTP Manager section of your control panel, it is not always the same as the password for your web hosting control panel.
Once connected you will see the folder(s) of your domain/subdomain. Simply download it to your computer.

If you have a database you need to export it from the phpMyAdmin, let me know if you need more information about this too.

Author:  yngwiethps [ Tue May 30, 2006 8:12 pm ]
Post subject: 

I've backed up my whole site with just FTP a couple of times but this way is really cool.

but i just looked back in my system_backup directory because i havnt saved the file on my pc yet, there is 2 files now!
a 182mb file and another that is 362. i have no idea

Author:  bonelifer [ Tue May 30, 2006 8:52 pm ]
Post subject: 

Remember to put the backup folder below the root of your site, ie make sure it isn't in the folder you are backing up or everytime you backup it's also backing up the old backup file, which is why the second one is twice the size of the first.

Author:  yngwiethps [ Tue May 30, 2006 9:38 pm ]
Post subject: 

okay thanks bro

Author:  ningleepo [ Wed May 31, 2006 4:25 pm ]
Post subject: 

woukld this be the absolute path? or do i need to add my sub domain at beginning?

/home/www/Source Pro

Author:  Dale [ Wed May 31, 2006 4:28 pm ]
Post subject: 

Whatever abspath.php says the path is is the path. :)

Author:  rm249 [ Sat Jul 22, 2006 1:37 am ]
Post subject: 

I plan on working on this script some and improving it, I will keep you updated on the progess of it and possibly post some of the code as it starts to progress.

Author:  rm249 [ Sun Jul 23, 2006 7:01 am ]
Post subject: 

Check this out for a easy to use frontend version of this script:
http://forum.100webspace.com/viewtopic.php?p=24035

Author:  Silent Sniper [ Thu Aug 10, 2006 1:35 am ]
Post subject: 

Would any body be able to back it up if they knew it was there?

Author:  bangis [ Fri Sep 22, 2006 7:47 pm ]
Post subject:  Re: dummy instructions for this?

White Raven wrote:
Dumb question...
I've never used FTP but am looking for an easy way to back up my site.
Any chance someone could give me a more detailed set of instructions to go with this? Or another easy way to back up an entire site?

Thanks,

Raven


Raven,

I found this software lately and maybe this can answer your need. It makes it easy to backup not just one but all my sites.

http://www.cpsitesaver.com

Hope this helps.

:D

Author:  bonelifer [ Tue Nov 14, 2006 1:00 am ]
Post subject: 

Silent Sniper wrote:
Would any body be able to back it up if they knew it was there?


Not if you put the backup file in a Password protected folder. Also make sure the backups are placed in a protected folder as well.

Author:  Kennethjek [ Thu Jan 15, 2015 5:21 am ]
Post subject:  Save yourself Backup your files

Looking to save records displayed on web GUI page to a file not sure hown I could do this I have added the button Save to file .Anyone have any ideas how to do this?

Author:  Jace Cohen [ Sat Aug 24, 2019 2:26 am ]
Post subject:  Re: Save yourself - Backup your files

Hello,

If you have a hosting account here our system automatically backs up your files, databases and mail contents. Available backups are kept for up to 30 days. We also offer the option to connect your hosting account to your Dropbox and Google Drive accounts, in order to backup your files and databases there.

Best Regards,
Jace Cohen

Author:  Jace Cohen [ Thu Nov 07, 2019 5:36 am ]
Post subject:  Re: Save yourself - Backup your files

Hello,

If you have an account with us you can backup the files of your account by going to Files -> Remote Backups. From there, you can connect your hosting account to your Google Drive account and our system will automatically begin backing up your files and will create new backups every other day. If you require further assistance, please open a ticket from the control panel of the hosting account so that we can properly assist you. You can open a ticket by hovering the mouse button over the Help Center button and selecting My Tickets.

Best Regards,
Jace Cohen

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/