It is currently Tue Jun 27, 2017 7:12 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 25 posts ] 
Author Message
 Post subject: Save yourself - Backup your files
PostPosted: Sat May 07, 2005 2:57 am 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
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.

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 3:53 am 
Noobie
Noobie

Joined: Sun Apr 24, 2005 11:13 pm
Posts: 48
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 12:21 pm 
I have no life!
I have no life!

Joined: Sun Feb 13, 2005 6:12 pm
Posts: 1504
Location: My Office
That is a very nice script. May I have permission to put it on my site for a download?

_________________
Best Regards:
Aaron McGowan (aka: CyberGeek, =cipher=)

CyberGeek's Software Solutions
-- WWW: http://www.cybergeeksoftware.com
-- Tech Line: 1-519-860-4557
-- Email: cybergeek@cybergeeksoftware.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 1:36 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
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.

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 1:37 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
=cipher= wrote:
That is a very nice script. May I have permission to put it on my site for a download?


Sure, no problem.

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 5:28 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
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.

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 9:02 am 
Noobie
Noobie

Joined: Sun Apr 24, 2005 11:13 pm
Posts: 48
This should really be a STICKY.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 8:00 pm 
Stickied :D


Top
  
 
 Post subject:
PostPosted: Sat Dec 24, 2005 2:44 pm 
Moderator
Moderator

Joined: Thu Dec 15, 2005 2:59 pm
Posts: 681
Location: England
Nice script bobg!..Saved my life hundreds of times :p

_________________
Mountain biking forum ;)
Ponds and fishkeeping :D


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 31, 2005 3:31 am 
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 :)


Top
  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 9:27 pm 
Noobie
Noobie

Joined: Thu Dec 29, 2005 11:05 pm
Posts: 10
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?

_________________
JayGreentree


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 11:56 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
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 =

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject: dummy instructions for this?
PostPosted: Tue Jan 31, 2006 8:19 pm 
Noobie
Noobie

Joined: Mon Sep 26, 2005 8:16 pm
Posts: 3
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 02, 2006 5:39 am 
Site Admin
Site Admin

Joined: Fri Feb 11, 2005 7:43 am
Posts: 1818
Location: 100WebSpace's Headquarters
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.

_________________
Read the F.A.Q. before asking a question!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 8:12 pm 
NO! I'm not a flooder!
NO! I'm not a flooder!

Joined: Tue Jun 14, 2005 10:28 pm
Posts: 110
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 8:52 pm 
Noobie
Noobie

Joined: Sun Apr 24, 2005 11:13 pm
Posts: 48
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 9:38 pm 
NO! I'm not a flooder!
NO! I'm not a flooder!

Joined: Tue Jun 14, 2005 10:28 pm
Posts: 110
okay thanks bro


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 4:25 pm 
Noobie
Noobie

Joined: Mon May 29, 2006 7:37 pm
Posts: 14
woukld this be the absolute path? or do i need to add my sub domain at beginning?

/home/www/Source Pro


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 4:28 pm 
Moderator
Moderator

Joined: Thu Dec 15, 2005 2:59 pm
Posts: 681
Location: England
Whatever abspath.php says the path is is the path. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 22, 2006 1:37 am 
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.


Top
  
 
 Post subject:
PostPosted: Sun Jul 23, 2006 7:01 am 
Check this out for a easy to use frontend version of this script:
http://forum.100webspace.com/viewtopic.php?p=24035


Top
  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 1:35 am 
Noobie
Noobie

Joined: Wed Aug 09, 2006 8:56 pm
Posts: 32
Location: UK
Would any body be able to back it up if they knew it was there?

_________________
$$ <-- Silent Sniper


Top
 Profile  
 
 Post subject: Re: dummy instructions for this?
PostPosted: Fri Sep 22, 2006 7:47 pm 
Noobie
Noobie

Joined: Fri Sep 22, 2006 7:42 pm
Posts: 3
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 1:00 am 
Noobie
Noobie

Joined: Sun Apr 24, 2005 11:13 pm
Posts: 48
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.


Top
 Profile  
 
 Post subject: Save yourself Backup your files
PostPosted: Thu Jan 15, 2015 5:21 am 
Noobie
Noobie

Joined: Sun Jan 04, 2015 4:47 pm
Posts: 3
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?

_________________
online pharmacy poland kaliningrad http://2getmeds.com top online pharmacy reviews


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011