Client Site BackUp for more than one day?

Discussion in 'Tips/Tricks/Mods' started by _X_, Oct 13, 2008.

  1. _X_

    _X_ New Member

  2. falko

    falko Super Moderator ISPConfig Developer

    This is currently not possible.
     
  3. mccharlet

    mccharlet Member HowtoForge Supporter

    Hi

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

    I have change this

    HTML:
                    // 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:
    #!/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 {} \;
     
  4. scottrill2

    scottrill2 Member

    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/showthread.php?t=46280&highlight=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
     

Share This Page