#!/usr/bin/perl # # Excerpted From # =============== # Date: Wed, 17 Jan 2001 08:42:55 -0800 (PST) # From: Alvin Oga # cc: debian-user # # # quickie...untested itty-bitty backup psudeo code ...we'll ignore bad code practices here... # # # in cron... ( crontab -e ) # ========== # # # Daily Incremental.. # 1 01 * * * /usr/scripts/Backup.mini.pl # # # Weekly incremental # # on Sat # 1 01 * * 6 /usr/scripts/Backup.mini.pl -inc32 # # # on Sunday # 1 02 * * 0 /usr/scripts/Backup.mini.pl -full # # # Monthly full too ??? # 01 0 1 * * /usr/scripts/Backup.mini.pl -full -dir ....stuff ... # # === end crontab entries # # # # this can be passed in as a variable if needed... my ( $DIR ) = "/root /etc /var/log /home/"; # my ( $Exclude ) = ".netscape/cache"; # throw this away # # ` mount /Backup ; cd /Backup`; # if not automounting - lock it down... # my ( $cnt ) = `cat /Backup/cnt.txt`; $cnt = 1 if ( $cnt eq 0 ); $cnt = "32" if ( $ARGV[0] eq "-inc32" ); # # my ( $period ) = "-mtime $cnt"; # $period = "" if ( $ARGV[0] eq "-full" ); # # my ( @date ) = split ( /\s+/, `date` ); # Wed Jan 03 00:55:58 PST 2001 my ( $Mon ) = $date[1]; my ( $Date ) = sprintf "%02d", $date[2]; # # # ` mkdir /Backup/$Mon ` if ( ! -d "/Backup/$Mon" ); # # # ========================= # primary line of interest # ========================= # ` find $DIR $period -type f -print | egrep -v $Exclude | tar zcvf /Backup/$Mon/${Date}.${cnt}.tgz -T - `; # # $cnt += 1; $cnt = 2 if ( $ARGV[0] eq "-full" ); # reset incremental counter since full backup ` echo $cnt > /Backup/cnt.txt `; # # ` cd /tmp ; umount /Backup `; # done # # end of file