On 01-Mar-2003 Scott Haneda wrote:
> I wrote a sh script to use mysqldump to iterate through my databases and
> dump them to .sql files, I am supplying no flags to mysqldump, and wonder,
> is there a "best way" to dump your files, if the idea is they are backups
> and to be used in the case of emergency.
>
Here's what I use :
---
#!/bin/sh
#
# dump database(s) each day --table by table
#
DBS="auth sales ar ap gl misc"
DUMP=$HOME/archive/database
DIR=`date +"%a"`
cd $DUMP
mkdir -p $DIR
rm -f Today
ln -sf $DIR Todayauth
cd $DIR
for K in $DBS
do
TBLS=`mysql -N -e "show tables" $K`
for I in $TBLS
do
mysqldump -e -q --add-drop-table $K $I >> $K.$I.dmp
rm -rf $K.$I.dmp.gz
gzip $K.$I.dmp
done
done
---
This gives a 7 day rotation, Mon-Sun.
With the latest dump in the 'Today' directory.
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php