#!/usr/bin/perl # # Written by Scott Noble -- May 22, 2003 # # Level-0 (complete) backup of : # head (/ /opt /home) and store (/ /var /home2) # # This script only FINDS the files that need to be backed up. # #################################################################### @machines = qw( head store ); $dirname{head} = '/home'; $dirname{store} = '/home2'; $backdir{head} = '/home/backups'; $backdir{store} = '/home2/backups'; $tarscript = '/home/backups/scripts/Start_tar'; $tape = 'head:/dev/tape'; $tar_stderrfile_pref{head} = '/home/backups/tar_stderr.out'; $tar_stderrfile_pref{store} = '/home2/backups/tar_stderr.out'; $tar_stdoutfile_pref{head} = '/home/backups/tar_stdout.out'; $tar_stdoutfile_pref{store} = '/home2/backups/tar_stdout.out'; $max_tries = 100; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon]; $email = 'psandhu@physics.ubc.ca'; ##################################################################### # Master regular expression of 'find' : ##################################################################### $findlist = '! \( \( -user inaki -and \( -name "*std_out*" -o -name "l=*_data" -o -name "l=*_mass" -o -name "l=*_r0" -o -name "gg" -o -name "hh" \) \) -o -name "*.sdf" -o -name "*.sdf.gz" -o -name "*.hdf" -o -name "*.dat" -o -name "*.DAT" -o -name "*.dat.gz" -o -name "*.segdat" -o -name "*.rgb" -o -name "*.o" -o -name core -o -type d \) -mount -size -20240k | grep -v .netscape/cache | grep -v home/daub |grep -v /backups/ |grep -v /home/vnfe2-tmp | grep -v /home/vnfe1-tmp'; ##################################################################### # Do backup for primary /home partitions: ##################################################################### foreach $mach ( @machines ) { #### Find all files to be backed up: $backuplist = join '', "$backdir{$mach}", '/', "$mach-level-0-index"; $findcmd = join '', 'find ', "$dirname{$mach}", " $findlist > $backuplist"; $findcmd = join '', "rsh $mach ", "'", "$findcmd", "'"; system($findcmd); }