On 4/24/07, Ian Dexter R. Marquez <[EMAIL PROTECTED]> wrote:

Hi, Jan:

The proof of the pudding is in the eating. ;) You'd have to test the
script first, preferably in a nondestructive way.

What I usually do is set up some mock directories, add some files and
test the backup script.

Looking at your script, since you're doing the backup locally, there's
no need for the [EMAIL PROTECTED]: variables. There's also a
syntax error in the $OPTS variable:

> -backup-dir=$BACKUP_HOME/$BACKUPDIR -av"

should be

--backup-dir= ...

Note the two leading dashes.

It's also a good thing to set up all your variables at the start of
the script. Call me an O.C. but here's what I would do:

<script>
#!/bin/sh

SRCDIR=/home/d3m/source
BAKHOME=/home/d3m/backup
BAKDIR=`date +%A`
LOGDIR=/home/d3m/log
TMPDIR=/home/d3m/tmp
OPTS="-av --force --ignore-errors --delete --backup
--backup-dir=$BAKHOME/$BAKDIR"
RSYNC=/usr/bin/rsync

# Start
date > $LOGDIR/backup.$BAKDIR.log

# Cleanup
[ -d $TMPDIR ] || mkdir $TMPDIR
$RSYNC --delete -a $TMPDIR $BAKHOME/$BAKDIR
rm -rf $TMPDIR

# Backup
$RSYNC $OPTS $SRCDIR $BAKHOME/current >> $LOGDIR/backup.$BAKDIR.log

exit 0
</script>


> scenario is that the /home directory will be backed up using an external
> hard drive attached to the local machine. i already formatted this drive
and
> named the partition /backup, however i did not auto mount it using
fstab, is
> it advisable to auto mount it?

Provided that it is attached to the box, you can just mount it using
the script, then unmount it afterwards. Quite useless if it's always
attached, but safe nevertheless.

Hope these help. Good luck with the script.

ian,

i tried to run the script i posted but i got so many errors too many to
mention, dunno the proper syntax, i thought it came from trend's KB :D

i'll give your's a try, will keep you posted. thanks.


jan
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to