#!/bin/bash # BASH script for backing up critical jabberd information (uses TAR files) # Date stamp uses Julian date + Year # Written by Van Aug-2003 # Change the variables below to reflect your environment: FQDN="im.jabs.org" PATHTOJAB="/usr/local/jabber" BKUPLOCATION="/root" CONFIGDIR="/etc/jabberd" echo "" if [ ! -e "$BKUPLOCATION" ] ; then echo "Backup directory does not exist..." echo "" exit 0 ; fi # Make directory in /tmp mkdir /tmp/jabback # Copy contents of spool directory to /tmp/jabback echo "Copying contents of spool directory..." cp -a $PATHTOJAB/spool /tmp/jabback # Copy config files from /etc/jabberd to /tmp/jabback echo "Copying contents of configuration directory..." cp -a $CONFIGDIR /tmp/jabback # TAR + GZIP the temp directory cd /tmp echo "TARing..." tar cf jabback.tar jabback echo "GZIPing..." gzip jabback.tar chmod 0400 jabback.tar.gz # Generate datestamp and change filename to match, move file to backup directory DATESTAMP=`date +%j-%y` echo "Moving file to $BKUPLOCATION..." echo "" mv jabback.tar.gz "jabkup-$DATESTAMP.tar.gz" mv "jabkup-$DATESTAMP.tar.gz" $BKUPLOCATION rm -rf /tmp/jabback # List and Exit echo "Jabberd backups:" echo "" ls -l $BKUPLOCATION/jabkup*gz echo "" echo "Done..." echo "" # End of BASH Script