#!/usr/local/bin/bash # # # # backup script to tar up main server configs, shell configs, web configs # , encrypt the tar file, then scp to randombackupserver.rootednetworks.com for storage. # # # Rooted Networks # Brett Krueger, bkrueger@sigterm.net # # 9-24-2004 Initial release # Release version v0.1 # # # #Some values, you might or might not have to edit to your liking. OUTFILENAME=full-backup.`date +"%m%d%Y"`.tar.cpt # athenas /etc directory rm -Rf /backups/athena/* tar -cf /backups/athena/athena-etc.tar /etc tar -cf /backups/athena/athena-root.tar /root # shell configs rm -Rf /backups/shell/* tar -cf /backups/shell/shell-etc.tar /home/shell/etc tar -cf /backups/shell/shell-root.tar /home/shell/root # web configs and db's rm -Rf /backups/web/* tar -cf /backups/web/web-etc.tar /home/web/etc tar -cf /backups/web/web-mysql.tar /home/web/var/db/mysql tar -cf /backups/web/web-usr-etc.tar /home/web/usr/local/etc tar -cf /backups/web/web-root.tar /home/web/root # sleep for a few secs before tarring everything sleep 5 # now tar them all up tar -cf /root/full-backup.tar /backups/* # system resting sleep 10 # now to encrypt the tar archive from nasty things happening to it on backup server possibly. # using ccrypt /usr/local/bin/ccrypt -R -r -e -K mys3cr3tk3y /root/full-backup.tar # sleep 10 seconds more, let the system rest after that mammoth of an encryption sleep 10 # now to scp it to our backup machine scp -i /root/.ssh/1337-key /root/full-backup*.tar.cpt root@random.rootednetworks.com:/backups/$OUTFILENAME # now delete the file on local server for good rm -Rf /root/full-backup*.tar.cpt # all done echo "all done with backup operation"