Thanks for the response swordfish
I found what you were talking about and in manage_backup
contents:
Code: Select all
#!/bin/bash
# direcory where rsync is putting it's files
BACKUP_SOURCE_DIR=/home/sxbackup
# directory where full archives will be stored
BACKUP_DEST_DIR=/full_backups
# number of days to keep archives for (ex: 7 would keep archives for the last 7 days)
DAYS_TO_RETAIN=7
NUMBER_OF_CURRENT_BAKUPS=`ls ${BACKUP_DEST_DIR}|wc -l`
DATE=`date +%a`
#echo ${NUMBER_OF_CURRENT_BAKUPS}
if [ ${NUMBER_OF_CURRENT_BAKUPS} -gt ${DAYS_TO_RETAIN} ]
then
let "NUMBER_TO_DELETE=${NUMBER_OF_CURRENT_BAKUPS} - ${DAYS_TO_RETAIN}"
echo "Deleting ${NUMBER_TO_DELETE} files"
for each_file in `ls -t ${BACKUP_DEST_DIR}| tail -${NUMBER_TO_DELETE}`
do
echo "deleting $each_file"
rm -f ${BACKUP_DEST_DIR}/$each_file
done
fi
tar zcf ${BACKUP_DEST_DIR}/sxbackup.$DATE.tgz ${BACKUP_SOURCE_DIR}
I could take the 7 day check and place it in front of what i have. Where the tar starts I would still need to keep what i have because I need to push it to our file storage server which is a Windows server. but that is neither hear nor there.
I also believe that the need to stop the services would help. that would at least give a full backup each night or when it is chose to run. I do think for getting a snapshot type file though out the day that you would keep the server up and running and just copy what you could down.
For a restore take the latest full and then the latest snapshot type tar and restore in that order.
Will this work? I'm not sure. I still question the hard links in the tar though. I really don't need to do a full restore of a server to find out that it is 3 times as large as it was. and have other issues.
Also what all services need to be stopped. In the past I have stopped: scalix scalix-tomcat scalix-postgres. Is there anything else that i'm missing to get a full backup of everything?
so far back up would look like
Code: Select all
#!/bin/bash
# direcory where rsync is putting it's files
BACKUP_SOURCE_DIR=/home/sxbackup
# directory where full archives will be stored
BACKUP_DEST_DIR=/full_backups
# number of days to keep archives for (ex: 7 would keep archives for the last 7 days)
DAYS_TO_RETAIN=7
NUMBER_OF_CURRENT_BAKUPS=`ls ${BACKUP_DEST_DIR}|wc -l`
DATE=`date +%a`
#echo ${NUMBER_OF_CURRENT_BAKUPS}
if [ ${NUMBER_OF_CURRENT_BAKUPS} -gt ${DAYS_TO_RETAIN} ]
then
let "NUMBER_TO_DELETE=${NUMBER_OF_CURRENT_BAKUPS} - ${DAYS_TO_RETAIN}"
echo "Deleting ${NUMBER_TO_DELETE} files"
for each_file in `ls -t ${BACKUP_DEST_DIR}| tail -${NUMBER_TO_DELETE}`
do
echo "deleting $each_file"
rm -f ${BACKUP_DEST_DIR}/$each_file
done
fi
service scalix-tomcat stop
service scalix stop
service scalix-postgres stop
# mount the shared directory of the server (this uses Samba because of the Window's FS)
mount -t cifs -o username=admin,password=password //xavier.domain.com/sysadmin /xavier/sysadmin
# Tar the /var/opt/scalix directory to the specified folder
tar -cvzf /xavier/sysadmin/Server\ Backups/scalix/scalix_`%s`.tar /var/opt/scalix/ >> /var/log/scalix_backup.log
#unmount the windows share
umount //xavier/sysadmin
service scalix-postgres start
service scalix start
service scalix-tomcat start
If this seems incorrect to anyone please let me know. And as always thank you all for your help and knowledge.