Backup script ~ not tested yet

29 09 2008

I have written a shall script which creates a tar file
and scp to remote machine.
It is working fine if … I run this script manualy (./backup_agent.sh)

file name is backup_agent.sh
—————————————-
#!/bin/sh
cd /var/BACKUP
tar -cvf cvsroot.tar /var/cvsroot
#tar -cvf cvsroot.tar cvsbackup.txt
gzip cvsroot.tar
/usr/bin/scp cvsroot.tar.gz root@192.168.1.100:/BEGANTO_BACKUP/cvs/cvsroot-$(date +%Y%m%d-%H%M%S).tar.gz
echo “Backup of cvsroot has been copied in form of .tar.gz file”
mv cvsroot.tar.gz cvsroot-$(date +%Y%m%d-%H%M%S).tar.gz
mail -s “CVS server backup” yogendra.rawat@beganto.com < cvsbackup.txt

Do this in the machine that has your cronjob

mkdir –p /root/.ssh
chmod 0700 /root/.ssh
ssh-keygen –t dsa –f /root/.ssh/id_dsa –P ”

then

copy /root/.ssh/id_dsa.pub to the backup server

then do this in your backup server

cat id_dsa.pub >> /root/.ssh/authorized_keys2
chmod 0600 /root/.ssh/ authorized_keys2


Actions

Information

One response

29 09 2008
Joel Althoff

Good idea! We use a similar process sometimes with rsync.

Leave a comment