[luau] Next up, back up

Tom_Gordon/RISE/HIDOE at notes.k12.hi.us Tom_Gordon/RISE/HIDOE at notes.k12.hi.us
Wed Oct 8 05:08:01 PDT 2003


I just tested it on my system.  If you want to start the process on any 
other day you can just change 01, I guess Sun is an ok weekly full backup 
date.

make sure you put quotes around all the variables.

change -cf to -Pcf, this makes the paths absolute (leading slash not 
removed).

I'm here if you need me.

Tom




Please respond to luau at videl.ics.hawaii.edu
Sent by:        luau-admin at videl.ics.hawaii.edu
To:     luau at videl.ics.hawaii.edu
cc:      
Subject:        Re: [luau] Next up, back up

On Tuesday, October 7, 2003, at 10:43  AM, tom_gordon at notes.k12.hi.us 
wrote:

> give him the old-reliable, tried and true methods like
> http://www.faqs.org/docs/securing/chap29sec306.html  see how much 
> simpler
> that script is than the rsync script?  Pretty much the same features.

Simple is my middle name. I think I'll use this script.

Now is the following okay? Will it work as is?

Step 1. wait for Oct 31st, since this cron script will run the next 
morning
      2. on Oct 31st, login as root
      3. create the file backup.sh, as below, in /etc/cron.daily/
      4. set perms of backup.sh to 755
      5. md /backups/last-full
      6. logout and let cron do its thing

#!/bin/sh
# full and incremental backup script
# created 07 February 2000
# Based on a script by Daniel O'Callaghan <danny at freebsd.org>
# and modified by Gerhard Mourani <gmourani at videotron.ca>

# Change the 5 variables below to fit your computer/backup

COMPUTER=liholiho-ltsp1                 # name of this computer
DIRECTORIES="/home"                     # directoris to backup
BACKUPDIR=/backups                      # where to store the backups
TIMEDIR=/backups/last-full              # where to store time of full 
backup
TAR=/bin/tar                            # name and locaction of tar

# You should not have to change anything below here

PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a`                          # Day of the week e.g. Mon
DOM=`date +%d`                          # Date of the Month e.g. 27
DM=`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.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.

# Monthly full backup
if [ $DOM = "01" ]; then
         NEWER=""
         $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
fi

# Weekly full backup
if [ $DOW = "Sun" ]; then
         NEWER=""
         NOW=`date +%d-%b`

         # Update full backup date
         echo $NOW > $TIMEDIR/$COMPUTER-full-date
         $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES

# Make incremental backup - overwrite last weeks
else

         # Get date of last full backup
         NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
         $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
fi

_______________________________________________
LUAU mailing list
LUAU at videl.ics.hawaii.edu
http://videl.ics.hawaii.edu/mailman/listinfo/luau






More information about the LUAU mailing list