30 |
my $DIR_TIME_FMT = '%Y%m%d'; # strftime format for backup dir |
my $DIR_TIME_FMT = '%Y%m%d'; # strftime format for backup dir |
31 |
|
|
32 |
my $LOG = '/var/log/backup.log'; # add path here... |
my $LOG = '/var/log/backup.log'; # add path here... |
33 |
$LOG = '/tmp/backup.log'; |
#$LOG = '/tmp/backup.log'; |
34 |
|
|
35 |
# store backups in which directory |
# store backups in which directory |
36 |
my $BACKUP_DEST = '/data/isis_backup'; |
my $BACKUP_DEST = '/backup/isis_backup'; |
37 |
|
|
38 |
# files to ignore in backup |
# files to ignore in backup |
39 |
my @ignore = ('.md5sum', '.backupignore', 'backupignore.txt'); |
my @ignore = ('.md5sum', '.backupignore', 'backupignore.txt'); |
40 |
|
|
41 |
# open log |
# open log |
42 |
open(L, "> $LOG") || die "can't open log $LOG: $!"; |
open(L, ">> $LOG") || die "can't open log $LOG: $!"; |
43 |
select((select(L), $|=1)[0]); # flush output |
select((select(L), $|=1)[0]); # flush output |
44 |
|
|
45 |
# make a lock on logfile |
# make a lock on logfile |
547 |
over network) |
over network) |
548 |
|
|
549 |
=item - usage of C<.md5sum> files (compatible with command-line utility |
=item - usage of C<.md5sum> files (compatible with command-line utility |
550 |
C<md5sum> to keep file between snapshots hard-linked |
C<md5sum>) to keep file between snapshots hard-linked |
551 |
|
|
552 |
=back |
=back |
553 |
|
|
591 |
|
|
592 |
server/c_WinNT_fonts/yyyymmdd/.... |
server/c_WinNT_fonts/yyyymmdd/.... |
593 |
|
|
594 |
|
=head2 Won't I run out of disk space? |
595 |
|
|
596 |
|
Of course you will... Snapshots and logfiles will eventually fill-up your disk. |
597 |
|
However, you can do two things to stop that: |
598 |
|
|
599 |
|
=head3 Clean snapshort older than x days |
600 |
|
|
601 |
|
You can add following command to your C<root> crontab: |
602 |
|
|
603 |
|
find /backup/isis_backup -type d -mindepth 3 -maxdepth 3 -mtime +11 -exec rm -Rf {} \; |
604 |
|
|
605 |
|
I assume that C</backup/isis_backup> is directory in which are your snapshots |
606 |
|
and that you don't want to keep snapshots older than 11 days (that's |
607 |
|
C<-mtime +11> part of command). |
608 |
|
|
609 |
|
=head3 Rotate your logs |
610 |
|
|
611 |
|
I will leave that to you. I relay on GNU/Debian's C<logrotate> to do it for me. |
612 |
|
|
613 |
=head1 AUTHOR |
=head1 AUTHOR |
614 |
|
|