All pastes #3764 Raw Edit

Snake007uk

public php v1 · immutable
#3764 ·published 2005-01-05 11:39 UTC
rendered paste body
#!/bin/sh# full and incremental backup script#Change the 5 variables below to fit your computer/backupCOMPUTER=orion                                  # name of this computerDIRECTORIES=/share                              # directoris to backupBACKUPDIR=/backup                               # where to store the backupsTIMEDIR=/backup/last-full                       # where to store time of full backupTAR=/bin/tar                                    # name and locaction of tar#You should not have to change anything below hereDOW=`date +%a`                          # Day of the week e.g. MonDOM=`date +%d`                          # Date of the Month e.g. 27DM=`date +%d%b`                         # Date and Month e.g. 27Sep# On the 1st of the month a permanet full backup is made# Every Sunday a full backup is made - overwriting last Sundays backup# The rest of the time an incremental backup is made. Each incremental# backup overwrites last weeks incremental backup of the same name.## Monthly full backupif [ $DOM = "01" ]; then        NEWER=""        $TAR -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIESfi# Weekly full backupif [ $DOW = "Sun" ]; then        NOW=`date +%d-%b`        # Udate full backup date        echo $NOW > $TIMEDIR/$COMPUTER-full-date        $TAR -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES# Make incremental backup - overwrite last weekselse        # Get date of last full backup        NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"        $TAR $NEWER -ucf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIESfi