Anzahl der Backups begrenzen (backup.pl)

Hilfe zu Znuny Problemen aller Art
Locked
joel
Znuny newbie
Posts: 52
Joined: 27 Jan 2011, 15:08
Znuny Version: 3.3.9

Anzahl der Backups begrenzen (backup.pl)

Post by joel »

Guten Morgen,
unser OTRS macht jeden Abend ein automatisches Backup über das backup.pl script. Ich möchte die Anzahl der Backups die gespeichert werden auf 2 Backups begrenzen.
Kann mir jemand sagen wo ich das einstellen kann?


Ich vermute irgendwo hier im backup.pl script:

Code: Select all

# remove old backups
if ( $Opts{r} ) {
    my %LeaveBackups;
    my ( $Year, $Month, $Day ) = Today_and_Now();
    for ( 0 .. $Opts{r} ) {
        my ( $DYear, $DMonth, $DDay ) = Add_Delta_Days( $Year, $Month, $Day, -$_ );
        $LeaveBackups{ sprintf( "%04d-%01d-%01d", $DYear, $DMonth, $DDay ) } = 1;
        $LeaveBackups{ sprintf( "%04d-%02d-%01d", $DYear, $DMonth, $DDay ) } = 1;
        $LeaveBackups{ sprintf( "%04d-%01d-%02d", $DYear, $DMonth, $DDay ) } = 1;
        $LeaveBackups{ sprintf( "%04d-%02d-%02d", $DYear, $DMonth, $DDay ) } = 1;
    }
    my @Directories = $CommonObject{MainObject}->DirectoryRead(
        Directory => $Opts{d},
        Filter    => '*',
    );
    for my $Directory (@Directories) {
        my $Leave = 0;
        for my $Data ( keys %LeaveBackups ) {
            if ( $Directory =~ m/$Data/ ) {
                $Leave = 1;
            }
        }
        if ( !$Leave ) {

            # remove files and directory
            print "deleting old backup in $Directory ... ";
            my @Files = $CommonObject{MainObject}->DirectoryRead(
                Directory => $Directory,
                Filter    => '*',
            );
            for my $File (@Files) {
                if ( -e $File ) {

                    #                    print "Notice: remove $File\n";
                    unlink $File;
                }
            }
            if ( rmdir($Directory) ) {
                print "done\n";
            }
            else {
                print "failed\n";
            }
        }
    }
}
Produktiv: OTRS: 3.3.10
SLES 11
postgresql
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Anzahl der Backups begrenzen (backup.pl)

Post by jojo »

root@vbox-cvs:/opt/otrs# scripts/backup.pl -h
backup.pl - backup script
Copyright (C) 2001-2014 xxx, http://otrs.com/
usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 30] [-t fullbackup|nofullbackup|dbonly]
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
joel
Znuny newbie
Posts: 52
Joined: 27 Jan 2011, 15:08
Znuny Version: 3.3.9

Re: Anzahl der Backups begrenzen (backup.pl)

Post by joel »

jojo wrote:root@vbox-cvs:/opt/otrs# scripts/backup.pl -h
backup.pl - backup script
Copyright (C) 2001-2014 xxx, http://otrs.com/
usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 30] [-t fullbackup|nofullbackup|dbonly]

Hi,
danke für die Antwort, reicht es also wenn ich im Script den Wert von 30 auf 2 setze unter:

print
"usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 2] [-t fullbackup|nofullbackup]\n";
exit 1;


dann bekomme ich als Info:
tickets:/opt/otrs/scripts # ./backup.pl -h
backup.pl <Revision 1.25> - backup script
Copyright (C) 2001-2011 xxx, http://otrs.org/
usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 2] [-t fullbackup|nofullbackup]
Produktiv: OTRS: 3.3.10
SLES 11
postgresql
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Anzahl der Backups begrenzen (backup.pl)

Post by jojo »

bitte geh und frage den Linuxadministrator wie man ein Kommandozeilenscript mit entsprechenden Optionen ausführt.
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Locked