LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   AutoMySQLBackup weekly backup modification (https://www.linuxquestions.org/questions/linux-newbie-8/automysqlbackup-weekly-backup-modification-878815/)

moyorakkhi 05-04-2011 01:15 PM

AutoMySQLBackup weekly backup modification
 
Hello,

I'm using AutoMySQLBackup (https://sourceforge.net/projects/automysqlbackup/) script to backup mysql db from several server.I need little help from you who is guru in scripting. I would like to take weekly backup after every 1 week and not every week. i.e. on every 14 days.

This is the weekly backup portion of the script:

Code:

# Weekly Backup
        if [ ${DNOW} = ${DOWEEKLY} ]; then
                ${ECHO} Weekly Backup of Database \( ${DB} \)
                ${ECHO}
                        dbdump "${DB}" "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql"
                        [ $? -eq 0 ] && {
                                ${ECHO} Rotating 5 weeks Backups...
                                ${FIND} "${BACKUPDIR}/weekly/${DB}" -mtime +35 -type f -exec ${RM} -v {} \;
                        }
                        compression "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql"
                        BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql${SUFFIX}"
                ${ECHO} ---------------------------------------------------------------------

Kindly help me to modify the script. Thanks for your help in advance.

spankbot 05-04-2011 01:31 PM

I would not modify the script. Instead, use cron to only run the script every 14 days.

By default, the automybackup setup instructions tell you to add a simlink in /etc/cron.daily. Instead of doing that, leave the script in a good location (ie, /usr/local/admin/bin) and setup a root cron job to run it every two weeks. Something like so...

Quote:

* * * * 0/2 /usr/local/admin/bin/automysqlbackup
The "0/2" means "every other Sunday".

moyorakkhi 05-04-2011 01:42 PM

Quote:

Originally Posted by spankbot (Post 4346493)
I would not modify the script. Instead, use cron to only run the script every 14 days.

By default, the automybackup setup instructions tell you to add a simlink in /etc/cron.daily. Instead of doing that, leave the script in a good location (ie, /usr/local/admin/bin) and setup a root cron job to run it every two weeks. Something like so...



The "0/2" means "every other Sunday".

Hi, thanks for you advice. If I run the script on every 14 days the daily mysql dump will not be taken. This script runs daily and takes daily, weekly and monthly backup with desired rotation. I'd like to run it daily but instead of taking backup on every saturday or sunday or whatever day select, it'll take backup on every 14 days. Thanks again.

spankbot 05-04-2011 02:07 PM

So you want daily backups, as well as a bi-weekly backups? I would consider contacting the author.

moyorakkhi 05-05-2011 12:06 AM

Quote:

Originally Posted by spankbot (Post 4346546)
So you want daily backups, as well as a bi-weekly backups? I would consider contacting the author.

I did actually. Haven't got any response :)


All times are GMT -5. The time now is 09:33 AM.