Go Back  HTML Forums - Free Webmaster Forums and Help Forums > SERVER ADMINISTRATION > Linux Administration
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 05-18-2005, 03:16 PM
  #1
Crouse
Adept (Level 5)
 
Crouse's Avatar
 
Join Date: Dec 2003
Location: Iowa
Posts: 41
iTrader: (0)
Crouse is on a distinguished road
Backup mysql databases script.

This script keeps 8 days worth of compressed mysql backups in /var/backups/mysql . Another good thing about this script is it backs each individual database seperately.

Code:
for i in `mysql -B -e "show databases" | tail +2`; do
mysqldump --opt $i | gzip -9 > /var/backups/mysql/$i.`date --iso-8601`.gz
ls -t /var/backups/mysql/$i.* | tail +7 | xargs rm -f
done
This is the mysql backup script that I use on our servers, worst case scenario (and it's happened), you can restore from any of the last 7 days worth of backups. Came in handy for me Multiple cron jobs, and using different directories for storage, you could backup several times per day if you wanted too.

Set the script in a cron job, and your databases get backed up regularly. The mysql databases are probably the most important part of my server really, the server software itself can be restored, as can the bulk of the static html/php that doesn't change.... but the mysql data changes by the minute, so it's nice to have backups that you can rely on to restore from if you need to.
__________________
http://opensuse.us] [OpenSUSE.us]
http://www.bbips.org [Bash Batch Image Processing Script]
http://www.usalug.org [USA Linux Users Group]
http://www.bashscripts.org [Bash Scripts for Linux]
Crouse is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 01:21 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.