The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Backup daily and weeky but my box backup only daily

Discussion in 'General Discussion' started by taotoon, Jun 28, 2005.

  1. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    root@server [/backup/cpbackup]# ls -alRF
    .:
    total 4
    drwx--x--x 4 root root 1024 Jun 27 01:01 ./
    drwx--x--x 3 root root 1024 Jun 27 01:00 ../
    drwx--x--x 4 root root 1024 Jun 29 01:05 daily/
    drwx--x--x 4 root root 1024 Jun 27 01:01 weekly/

    ./daily:
    total 43770
    drwx--x--x 4 root root 1024 Jun 29 01:05 ./
    drwx--x--x 4 root root 1024 Jun 27 01:01 ../
    drwx------ 2 root root 1024 Jun 27 01:00 dirs/
    drwx------ 2 root root 1024 Jun 29 01:00 files/
    -rw------- 1 root root 44726442 Jun 29 01:05 thumbnow.tar.gz

    ./daily/dirs:
    total 18537
    drwx------ 2 root root 1024 Jun 27 01:00 ./
    drwx--x--x 4 root root 1024 Jun 29 01:05 ../
    -rw------- 1 root root 556 Jun 29 01:00 _etc_proftpd.tar.gz
    -rw------- 1 root root 1583 Jun 29 01:00 _etc_ssl.tar.gz
    -rw------- 1 root root 228 Jun 29 01:00 _etc_valiases.tar.gz
    -rw------- 1 root root 181 Jun 29 01:00 _etc_vdomainaliases.tar.gz
    -rw------- 1 root root 184 Jun 29 01:00 _etc_vfilters.tar.gz
    -rw------- 1 root root 7474798 Jun 29 01:01 _usr_local_cpanel_3rdparty_mailman.tar.gz
    -rw------- 1 root root 10825221 Jun 29 01:00 _usr_local_frontpage.tar.gz
    -rw------- 1 root root 100316 Jun 29 01:00 _usr_share_ssl.tar.gz
    -rw------- 1 root root 429263 Jun 29 01:00 _var_cpanel.tar.gz
    -rw------- 1 root root 94877 Jun 29 01:01 _var_lib_mysql_.tar.gz
    -rw------- 1 root root 629 Jun 29 01:00 _var_log_bandwidth.tar.gz
    -rw------- 1 root root 1416 Jun 29 01:00 _var_named.tar.gz
    -rw------- 1 root root 1235 Jun 29 01:00 _var_spool_cron.tar.gz

    ./daily/files:
    total 54
    drwx------ 2 root root 1024 Jun 29 01:00 ./
    drwx--x--x 4 root root 1024 Jun 29 01:05 ../
    -rw------- 1 root root 7637 Jun 29 01:00 _etc_exim.conf.gz
    -rw------- 1 root root 55 Jun 29 01:00 _etc_fstab.gz
    -rw------- 1 root root 347 Jun 29 01:00 _etc_group.gz
    -rw------- 1 root root 14122 Jun 29 01:00 _etc_httpd_conf_httpd.conf.gz
    -rw------- 1 root root 29 Jun 29 01:00 _etc_ips.gz
    -rw------- 1 root root 60 Jun 29 01:00 _etc_localdomains.gz
    -rw------- 1 root root 95 Jun 29 01:00 _etc_my.cnf.gz
    -rw------- 1 root root 523 Jun 29 01:00 _etc_named.conf.gz
    -rw------- 1 root root 607 Jun 29 01:00 _etc_passwd.gz
    -rw------- 1 root root 90 Jun 29 01:00 _etc_proftpd.conf.gz
    -rw------- 1 root root 47 Jun 29 01:00 _etc_quota.conf.gz
    -rw------- 1 root root 292 Jun 29 01:00 _etc_rndc.conf.gz
    -rw------- 1 root root 37 Jun 29 01:00 _etc_secondarymx.gz
    -rw------- 1 root root 266 Jun 29 01:00 _etc_shadow.gz
    -rw------- 1 root root 798 Jun 29 01:00 _etc_wwwacct.conf.gz
    -rw------- 1 root root 14129 Jun 29 01:00 _usr_local_apache_conf_httpd.conf.gz

    ./weekly:
    total 25797
    drwx--x--x 4 root root 1024 Jun 27 01:01 ./
    drwx--x--x 4 root root 1024 Jun 27 01:01 ../
    drwx------ 2 root root 1024 Jun 27 01:00 dirs/
    drwx------ 2 root root 1024 Jun 27 01:00 files/
    -rw------- 1 root root 26357909 Jun 27 01:01 thumbnow.tar.gz

    ./weekly/dirs:
    total 18499
    drwx------ 2 root root 1024 Jun 27 01:00 ./
    drwx--x--x 4 root root 1024 Jun 27 01:01 ../
    -rw------- 1 root root 548 Jun 27 01:00 _etc_proftpd.tar.gz
    -rw------- 1 root root 1583 Jun 27 01:00 _etc_ssl.tar.gz
    -rw------- 1 root root 228 Jun 27 01:00 _etc_valiases.tar.gz
    -rw------- 1 root root 181 Jun 27 01:00 _etc_vdomainaliases.tar.gz
    -rw------- 1 root root 184 Jun 27 01:00 _etc_vfilters.tar.gz
    -rw------- 1 root root 7474833 Jun 27 01:00 _usr_local_cpanel_3rdparty_mailman.tar.gz
    -rw------- 1 root root 10824429 Jun 27 01:00 _usr_local_frontpage.tar.gz
    -rw------- 1 root root 100316 Jun 27 01:00 _usr_share_ssl.tar.gz
    -rw------- 1 root root 414951 Jun 27 01:00 _var_cpanel.tar.gz
    -rw------- 1 root root 71186 Jun 27 01:00 _var_lib_mysql_.tar.gz
    -rw------- 1 root root 629 Jun 27 01:00 _var_log_bandwidth.tar.gz
    -rw------- 1 root root 1416 Jun 27 01:00 _var_named.tar.gz
    -rw------- 1 root root 1223 Jun 27 01:00 _var_spool_cron.tar.gz

    ./weekly/files:
    total 54
    drwx------ 2 root root 1024 Jun 27 01:00 ./
    drwx--x--x 4 root root 1024 Jun 27 01:01 ../
    -rw------- 1 root root 7637 Jun 27 01:00 _etc_exim.conf.gz
    -rw------- 1 root root 55 Jun 27 01:00 _etc_fstab.gz
    -rw------- 1 root root 347 Jun 27 01:00 _etc_group.gz
    -rw------- 1 root root 14122 Jun 27 01:00 _etc_httpd_conf_httpd.conf.gz
    -rw------- 1 root root 29 Jun 27 01:00 _etc_ips.gz
    -rw------- 1 root root 60 Jun 27 01:00 _etc_localdomains.gz
    -rw------- 1 root root 95 Jun 27 01:00 _etc_my.cnf.gz
    -rw------- 1 root root 523 Jun 27 01:00 _etc_named.conf.gz
    -rw------- 1 root root 607 Jun 27 01:00 _etc_passwd.gz
    -rw------- 1 root root 60 Jun 27 01:00 _etc_proftpd.conf.gz
    -rw------- 1 root root 47 Jun 27 01:00 _etc_quota.conf.gz
    -rw------- 1 root root 292 Jun 27 01:00 _etc_rndc.conf.gz
    -rw------- 1 root root 37 Jun 27 01:00 _etc_secondarymx.gz
    -rw------- 1 root root 266 Jun 27 01:00 _etc_shadow.gz
    -rw------- 1 root root 798 Jun 27 01:00 _etc_wwwacct.conf.gz
    -rw------- 1 root root 14129 Jun 27 01:00 _usr_local_apache_conf_httpd.conf.gz
    root@server [/backup/cpbackup]#
     
  2. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    As I remember on the previous hosting.


    It will backup to both folder -> daily and weekly.
     
  3. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    From /scripts/cpbackup

    Code:
    if ($CONF{'BACKUPINT'} eq "monthly") {
            if (! -e "${basedir}/monthly") {
                    mkdir("${basedir}/monthly",0711);
                    backupaccts("${basedir}/monthly");
            } else {
                    chmod(0711,"${basedir}/monthly");
                    if (isolderthen(29,"${basedir}/monthly")) {
                            backupaccts("${basedir}/monthly");
                    } else {
                            print "Monthly Backup is up to date\n";
                    }
            }
    }
    
    
    if ($CONF{'BACKUPINT'} eq "weekly") {
            if (! -e "${basedir}/weekly") {
                    mkdir("${basedir}/weekly",0711);
                    backupaccts("${basedir}/weekly");
            } else {
                    chmod(0711,"${basedir}/weekly");
                    if (isolderthen(6,"${basedir}/weekly")) {
                            backupaccts("${basedir}/weekly");
                    } else {
                            print "Weekly Backup is up to date\n";
                    }
            }
            if ($CONF{'BACKUPRETMONTHLY'} ne "0") {
                    if (! -e "${basedir}/monthly" || isolderthen(29,"${basedir}/monthly")) {
                            chmod(0711,"${basedir}/monthly");
                            if($CONF{'BACKUPTYPE'} eq "ftp") {
                                    mkdir("${basedir}/monthly",0711);
                                    backupaccts("${basedir}/monthly");
                            } else {
                                    cpusystem("rsync",$rsyncopts,"--delete","${basedir}/weekly/","${b
    asedir}/monthly");
                            }
                    }
            }
    }
    
    if ($CONF{'BACKUPINT'} eq "daily") {
            if (! -e "${basedir}/daily") {
                    mkdir("${basedir}/daily",0711);
                    backupaccts("${basedir}/daily");
            } else {
                    chmod(0711,"${basedir}/daily");
                    if (isolderthen(.5,"${basedir}/daily")) {
                            backupaccts("${basedir}/daily");
                    } else {
                            print "Daily Backup is up to date\n";
                    }
            }
            if ($CONF{'BACKUPRETWEEKLY'} ne "0") {
                    if (! -e "${basedir}/weekly" || isolderthen(6,"${basedir}/weekly")) {
                            chmod(0711,"${basedir}/weekly");
                            if($CONF{'BACKUPTYPE'} eq "ftp") {
                                    mkdir("${basedir}/weekly",0711);
                                    backupaccts("${basedir}/weekly");
                            } else {
                                    cpusystem("rsync",$rsyncopts,"--delete","${basedir}/daily/","${ba
    sedir}/weekly");
                            }
                    }
            }
            if ($CONF{'BACKUPRETMONTHLY'} ne "0") {
                    if (! -e "${basedir}/monthly" || isolderthen(29,"${basedir}/monthly")) {
                            chmod(0711,"${basedir}/monthly");
                            if($CONF{'BACKUPTYPE'} eq "ftp") {
                                    mkdir("${basedir}/monthly",0711);
                                    backupaccts("${basedir}/monthly");
                            } else {
                                    cpusystem("rsync",$rsyncopts,"--delete","${basedir}/daily/","${ba
    sedir}/monthly");
                            }
                    }
            }
    }
    
    
    
    sub isolderthen {
            my($days,$file) = @_;
            my($mtime);
    
                       (undef,undef,undef,undef,undef,undef,undef,undef,
                          $undef,$mtime,undef,undef,undef)
                              = stat($file);
            if ((time() - $mtime) > (60*60*24*${days})) {
                    return(1);
            } else {
                    return(0);
            }
    
    }
    
    Is older than 0.5 days then daily backup ---> correct
    Is older than 6 days then sync weekly backup ----> I think it's not correct
    Is older than 29 days then sync monthy backup ----> I think it's not correct
     
    #3 taotoon, Jun 28, 2005
    Last edited: Jun 28, 2005
  4. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    -rwx------ 1 root root 11261 Jun 26 03:04 cpbackup*
    -rwx------ 1 root root 9373 Jun 8 2003 cpbackup2*


    root@server [/scripts]# more /etc/cpbackup.conf
    BACKUPACCTS yes
    BACKUPDAYS 0,1,2,3,4,5,6
    BACKUPDIR /backup
    BACKUPENABLE yes
    BACKUPFILES yes
    BACKUPFTPDIR
    BACKUPFTPHOST
    BACKUPFTPPASS
    BACKUPFTPPASSIVE no
    BACKUPFTPUSER
    BACKUPINC no
    BACKUPINT daily
    BACKUPLOGS yes
    BACKUPMOUNT no
    BACKUPRETDAILY 1
    BACKUPRETMONTHLY 0
    BACKUPRETWEEKLY 1
    BACKUPTYPE normal
    DIEIFNOTMOUNTED no
    MYSQLBACKUP both
    BACKUPCHECK yes
    BACKUP2 yes
     
Loading...

Share This Page