BackupPC-users

Re: [BackupPC-users] Auto Archiving of hosts

2010-03-05 04:02:59
Subject: Re: [BackupPC-users] Auto Archiving of hosts
From: Michael <michael.auckland AT gmail DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Fri, 5 Mar 2010 22:01:13 +1300
I use daily cron job to backup latest data to extranel USB ( connected
to different computer than backuppc and use NTFS as files system )

Here script what I use: ( hope it will help someone.

#!/bin/sh

LOG=/tmp/usb.log
# localdirectory
LDIR=/mnt/tmp
#host to backup
$BKHOST=server1
#remote host
RHOST=vhoc2h
#remote directory
RDIR=/mnt/usb
#remote usb device
RDEV1=/dev/sdg1
RDEV2=/dev/sdh1

mv $LOG.old $LOG.old2
mv $LOG $LOG.old

echo `date` > $LOG
echo 'staring backup to extarnal usb' >> $LOG

FILENAME=`date +%Y.%m.%d`
if ssh $RHOST "mount.ntfs-3g $RDEV1 $RDIR"
then
echo "mount USB ok" >> $LOG
    if sshfs vhoc2h:/$RDIR $LDIR
        then echo "mounted ok" >> $LOG
        else echo 'eror mounting sshfs' >> $LOG
        exit 1
        fi

# clean oldweeek: and dayfiles
#mkdir -p $LDIR/BACKUP
find $LDIR/BACKUP -mtime +3 -exec rm {} \; >> $LOG 2>&1
find $LDIR/BACKUP -type d -empty -exec rmdir {} \; >> $LOG 2>&1

/usr/share/backuppc/bin/BackupPC_tarCreate -t -h $BKHOST -n -1 -s \* .
| /bin/gzip > $LDIR/BACKUP/$FILENAME.tar.gz
sync
else
 echo 'error' >> $LOG
 exit 1;
fi

echo 'Backup finished' >> $LOG
df -hT >> $LOG

umount $LDIR >> $LOG 2>&1

#umount remote usb drive
ssh $RHOST "umount $RDIR" >> $LOG 2>&1

#### EOF

-- 
--
Michael

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [BackupPC-users] Auto Archiving of hosts, Michael <=