SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Auto Archiving of hosts
Author Message
Post Auto Archiving of hosts 
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® 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.net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB