Sponsored Content
Full Discussion: Mysqldump rotate backup
Top Forums Shell Programming and Scripting Mysqldump rotate backup Post 302825783 by timgolding on Tuesday 25th of June 2013 06:42:03 AM
Old 06-25-2013
Mysqldump rotate backup

I have a very simple script that uses a cron job to take a daily backup of our orders database.

Code:
echo "Dumping ORDERS database";
mysqldump -u root --password='mypassword' -h '1.1.1.1' --opt --compress ORDERS $tbl_names > /Volumes/Files_Backup_1/db_backups/orders.sql
echo "Copied database to external disk";

This will make a single backup on the external hard disk. My worry is if somehow the orders database was TRUNCATED, DROPPED then that evening the database backup would overwrite the empty version of the database to the backup and i would be in big trouble. What i need to know how to do it understand how i can use mysqldump to make a weeks worth of daily backup. Maybe a mon, tue, wed, thur, fri, sat, sun backup or something similar.

I could do

Code:
mysqldump ... > database_$(date +%Y_%m_%d).sql

Or something but then my backup disk would fill up. I need some way of deleting the older backups. Any ideas
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies

2. UNIX for Dummies Questions & Answers

mysqldump bus error - cored dumped

hi, I need to backup a database but I'm getting the error "bus error - core dumped" just after I run mysqldump command. The server has installed solaris 9. Any help would be appreciated (3 Replies)
Discussion started by: dahr
3 Replies

3. UNIX for Advanced & Expert Users

mysqldump slowing down the process?

Hi All, I have a data calculation process-a perl script running each and every hour which will do some calculations on the data stored in a mysql server. Normally it tooks around 2minutes (max) to complete. But in case if i did any actions on the linux box where the database is... (7 Replies)
Discussion started by: DILEEP410
7 Replies

4. Shell Programming and Scripting

Help needed for mysqldump command

I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command: mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log Is there anything wrong with the syntax? ---------- Post updated at 08:32 PM... (0 Replies)
Discussion started by: proactiveaditya
0 Replies

5. UNIX for Dummies Questions & Answers

Problem with my crontab file, using mysqldump

My crontab file tells cron to run a certain shell script at 10:30 AM every day. The shell script backs up my database with mysqldump and then runs a sed script that does some editing of the backup file. I have programmed the shell script to write an error message to a file I have in my home... (1 Reply)
Discussion started by: Ultrix
1 Replies

6. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

7. UNIX for Dummies Questions & Answers

Mysqldump certain tables

Hi, I have to upload part of my database periodically when i make changes to product data etc. However I only want to upload certain tables. We suffer from bandwidth chock here, so i want to write a couple of separate scripts that upload parts of the database that changed. The database is large... (5 Replies)
Discussion started by: timgolding
5 Replies

8. Shell Programming and Scripting

Need Help with automatically Import from special mysqldump

Hi @ all I need a little bit help with a tricky problem ... Here´s the situation: We´ve 2 MySQL-Servers, one is productive, the other is Backup. At the productive Server there runs every 2 hours a cron Job which does a Dump from MySQL-DB with script 'automysqlbackup.sh' and copy it then... (7 Replies)
Discussion started by: jackcracker
7 Replies
BACKUP.D(5)							backupninja package						       BACKUP.D(5)

NAME
BACKUP.D - Action configuration files for backupninja(1). SYNOPSIS
/etc/backup.d/* DESCRIPTION
To preform the actual backup actions, backupninja processes each action configuration file in /etc/backup.d according to the file's suffix. .sh run this file as a shell script. .rdiff backup action for rdiff-backup. .dup backup action for duplicity. .maildir backup action for slow, incremental rsyncs of tens of thousands of maildirs. .mysql backup action for safe MySQL dumps. .pgsql backup action for safe PostgreSQL dumps. .sys backup action for general system reports and hardware information. .svn backup action for safe backups of subversion repositories. .trac backup action for safe backups of trac repositories. .makecd backup action for burning backups to CD/DVD or creating ISOs. These files must be owned by root and must not be world or group readable/writable. Support for additional configuration types can be added by dropping bash scripts with the name of the suffix into /usr/share/backupninja. The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style." For example: 10-local.pgsql.disabled 15-runthisfirst.sh 20-runthisnext.mysql 90-runthislast.rdiff Typically, you will put a '.rdiff' config file last, so that any database dumps you make are included in the filesystem backup. Action con- figurations which end with .disabled are skipped. Example templates for the action configuration files can be found in /usr/share/doc/backupninja/examples. You can also use ninjahelper(1), a console based "wizard" for creating backup actions. SCHEDULING
By default, each configuration file is processed everyday at 01:00 (1 AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file. Special value 'manual' will disable scheduling for the backup action. It is pos- sible to run the backup action manually by invoking ninjahelper(1) with --run command line argument. For example: when = sundays at 02:00 when = 30th at 22 when = 30 at 22:00 when = everyday at 01 when = Tuesday at 05:00 when = hourly when = manual These values for "when" are invalid: when = tuesday at 2am when = tuesday at 2 when = tues at 02 A configuration file will be processed at the time(s) specified by the "when" option. If multiple "when" options are present, then they all apply. If two configurations files are scheduled to run in the same hour, then we fall back on the alphabetical ordering specified above. The "when" must occur before any sections in the action configuration file. FILE FORMAT
The file format of the action configuration files is "ini style." Sections are created by using square bracket. Long lines are connected with a backslash. For example: # this is a comment [fishes] fish = red fish = blue [fruit] apple = yes pear = no thanks i will not have a pear. SEE ALSO
backupninja(1), ninjahelper(1), backupninja.conf(5), AUTHOR
BACKUPNINJA was written by the riseup.net collective. riseup October 10, 2005 BACKUP.D(5)
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy