HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   Client Site BackUp for more than one day? (http://www.howtoforge.com/forums/showthread.php?t=27743)

_X_ 13th October 2008 02:23

Client Site BackUp for more than one day?
 
When autobackup is enabled ISPConfig delete all files in backup folder and creates backup for last day.

http://www.howtoforge.com/forums/showthread.php?t=12339

:confused: Is there a way to set how many days to keep backups or how to set ISPConfig not to delete backup files?

falko 13th October 2008 12:53

This is currently not possible.

mccharlet 13th October 2008 19:56

Hi

I have modify the backup script to redirect the backup to /backup

I have change this

HTML Code:

                // Move file in /backup directory
//                $backup_dir = $httpd_root ."/web".$web_id."/backup";
                $backup_dir = "/backup/web".$web_id;
//                $web_user = fileowner($web_pfad);
//                $web_group = filegroup($web_pfad);
                if(!@is_dir($backup_dir)) {
                  mkdir($backup_dir,0755);
                } else {
                  exec("rm -rf $backup_dir/*");
                }
/*                if(@fileowner($backup_dir) != $web_user) {
                  chown($backup_dir,$web_user);
                }
                if(@filegroup($backup_dir) != $web_group) {
                  chgrp($backup_dir,$web_group);
                }
*/

I have create a perl script for moving the backup file to the same folder and rename them

HTML Code:

#!/usr/bin/perl
$repertoire = @ARGV[0];
$rep_backup= @ARGV[1];
$fichier_log= @ARGV[2];

open LOG,">".$fichier_log;
if ( @ARGV != 3 )
{
        print "\nSyntax: perl mv-backup.pl repertoire_sources repertoire_dest fichier_log \n\n";
        exit 1;
}

if (substr($repertoire,length($repertoire)-1) ne "/"){
        $repertoire = $repertoire."/";
}

#lecture des fichiers d'un repertoire
opendir REP,$repertoire or die "impossible d'ouvrir le repertoire";
@fichiers = readdir REP;
closedir REP;
foreach $fichier (@fichiers){
        $prefixe= $fichier."_";
        $fichier = $repertoire.$fichier;

        if (($fichier ne $repertoire."..") and ($fichier ne $repertoire.".") and (-d $fichier)){
                $fichier=$fichier."/";
                opendir REP,$fichier or die "impossible d'ouvrir le repertoire";
                @fichiers2 = readdir REP;
                closedir REP;

          foreach $fichier2 (@fichiers2){
                        $nom_fichier = $fichier2;
                        $fichier2 = $fichier.$fichier2;
                        if (-f $fichier2){
                                print LOG "$fichier2\n";

                                rename $fichier2,$rep_backup.$prefixe.$nom_fichier;
                                print $fichier2,$rep_backup.$prefixe.$nom_fichier."\n\r";
                        }
                }

        }
}
close LOG;

perl mv-backup.pl /backup/ /sites/ log_file_mv.txt

And with this command i delete older than four days
find /sites/ -mtime +4 -exec rm {} \;

scottrill2 22nd July 2010 22:42

Is this still valid?
 
Hello folks,


I find myself making lots of mistakes while learning about webs etc. Im trying to teach myself multiple things so I have for instance a practice drupal site, practice joomla site, practice word press site etc.


I often forget to make a backup then I screw the proverbial pooch on something, and have to start waaaaay back to my last backup. (which maybe isnt a bad thing since it makes me practice over and over lol)

I have a few questions regarding this autobackup setup.

1. Is this still the best way to do autobackups, with the post being two years old? I found this one searching http://www.howtoforge.com/forums/sho...=backup+script But that one looks highly complex and also says restoring etc can have very bad results, should I pursue this route or the other one?


2. The code that is in swiss or french, can that just be plugged into google translate? I know sometimes things don't translate well because of verb conjugation etc.

3. Once translated I would save it to cgi bin? and run the command listed at the bottom?


Thanks as always,

Scott


All times are GMT +2. The time now is 05:44.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.