Sharon McNeal wrote:

 > Jake Vickers wrote:
 >
 > I found where the issue was coming into play. When the script was
 > refactored a space was accidentially introduced into the mysqldump
 > routine that should not be there. I have fixed the error and if you
 > download just the qtp-backup script from the QTP web site
 > (http://qtp.qmailtoaster.com) this will correct the issue.
 > Or you can edit the qtp-backup script and change line number 172 to look
 > like this:
 > -p$mysql_password \

Thanks that did work.

It appears that when we keep a few days worth of backups in our /backup/qmailbkup directory, that the old backups are being included when the script condenses all the individual backups into 1 file. How would we modify the qtp-backup script so it only condenses down the current backup information into one file and leaves the previous backups alone?


We are setting up the server so the qtp-backup script runs each night using our /etc/crontab file. Then we copy the backup file to an external USB hard drive. We also have lines to delete out the backups that are older than 3 days on the server itself and older than 14 days on the external USB hard drive.

In case other people are interested in backing up to an external USB Drive -- We do this with the following lines in our /etc/crontab file:

# backup the qmailtoaster data files including squirrelmail plugins
05 2 * * * root /usr/sbin/qtp-backup

# copy today's backup file to USB drive to the postofficeBkups directory
32 03 * * * root find /backup/qmailbkup/* -type f -name '*' -mtime -1 -exec cp {} /mnt/usbdrive/postofficeBkups/ \;


# delete local mail backups more than 3 days old
32 04 * * * root find /backup/qmailbkup/ -type f -cmin +4320 -exec rm -f {} \;

# delete mail backups more than 14 days old (from time changed) on external USB drive 01 05 * * * root find /mnt/usbdrive/postofficeBkups/ -type f -ctime 14 -exec rm -f {} \;


Sharon,
Rather than putting each command as a separate cron entry and having to worry about timing, it would be a better practice to put all of the commands in one script, then invoke the script with a single crontab entry. The /usr/local/bin/mybackup script would look like this:

#!/bin/sh
# script to backup qmt, and manage backup files
#
# do the backup
qtp-backup
#
# copy today's backup file to USB drive to the postofficeBkups directory
find /backup/qmailbkup/* -type f -name '*' -mtime -1 \
      -exec cp {} /mnt/usbdrive/postofficeBkups/ \;
#
# delete local mail backups more than 3 days old
find /backup/qmailbkup/ -type f -cmin +4320 \
      -exec rm -f {} \;
#
# delete mail backups more than 14 days old (from time changed)
# on external USB drive
find /mnt/usbdrive/postofficeBkups/ -type f -ctime 14 \
      -exec rm -f {} \;
exit 0

Then you can start the whole process with a single crontab entry:
05 2 * * * root /usr/local/bin/mybackup
and you don't need to worry about one step finishing before the next one is executed.

Be sure that your script file's execute bits are turned on:
# chmod 755 /usr/local/bin/mybackup

If the exact time of day isn't critical, you can alternatively put your script in the /etc/cron.daily/ directory, and it will run every day at 4am, and you won't have to change the crontab file at all.

Hope that helps. (and thanks again!)
--
-Eric 'shubes'


---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
   Vickers Consulting Group offers Qmailtoaster support and installations.
     If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
    Please visit qmailtoaster.com for the latest news, updates, and packages.
To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]


Reply via email to