Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-21-2006, 07:25 AM   #1
LQ Newbie
Registered: Jun 2005
Location: Australia
Distribution: Ubuntu
Posts: 16

Rep: Reputation: 0
Question Scheduling MySQL database backups with date dependent filenames

Just wondering if it is possible to tell a MySQL server to backup files at a set interval but with a different filename each time which reflects the date. I know scheduled backups with the same name are possible (done through webmin, other ways too?), but this isn't what I'm looking for.

For example:

at 1am on January 22, 2006, the backup will be saved to a specified directory with the name 22-1-2006-DBNAME.sql

at 1am on January 23, 2006, the backup will be saved to a specified directory with the name 23-1-2006-DBNAME.sql

etc etc

Last edited by pepolez; 01-21-2006 at 07:26 AM.
Old 01-21-2006, 09:45 AM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 266Reputation: 266Reputation: 266
Here's a portion of a script I made to place in my /etc/cron.daily directory to do daily backups of my databases..

# System Backup Script.

date=$(date +%F)

cd /backup/mysql
mysqldump -u<username> -p<password> --databases dbname > $filename_dbname.sql
gzip $filename_dbname.sql

exit 0
I actually have different hosts so that's why I also have the host name in it. But that should pretty much do what you want, just change the small amount to customize.

Last edited by trickykid; 01-22-2006 at 08:10 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scheduling nightly backups with Red Hat 9 fturcic Linux - Software 1 03-11-2005 01:50 AM
Differing download speeds when compared to XP computers on the network AntWarrior Linux - Wireless Networking 2 12-07-2004 03:28 AM
Pthread scheduling... msriram_linux Programming 3 11-21-2004 03:57 PM
usb-storage problem with differing devices ta0kira Slackware 1 11-14-2004 12:09 PM
scheduling again nautilus_1987 Linux - Software 2 07-04-2003 07:53 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration