Quote:
Originally Posted by mike2010
I was checking out the script TenTenths recommended just now. It seems decent, but there's a much shorter one here that was also recommended to me -
|
That's pretty much the same script, with no remarks, no progress indication, no stopping of slave replication, etc.
Also, it does the gzip of the database "on the fly", so if you have a huge database then your backup could spend quite a while dumping that one database.
My script does the database dumping part and then does the compression.
If having the script "shorter" is THAT important to you, here's mine with the remarks, progress, and slave stuff taken out.
Code:
#!/bin/bash
BACKUPDIR=/backup
DBLIST="your list of databases here"
USEROPTIONS="-ubackup -pQwErTy123"
DUMPOPTIONS="--lock-all-tables"
BINDIR=/usr/bin
BACKUPDATE=$(/bin/date +a)
for DATABASE in ${DBLIST} ; do
${BINDIR}/mysqldump ${USEROPTIONS} ${DUMPOPTIONS} ${DATABASE} > ${BACKUPDIR}/${DATABASE}_${BACKUPDATE}.sql
done
${BINDIR}/gzip -f ${BACKUPDIR}/*_${BACKUPDATE}.sql
Oh look, it's actually 2 lines shorter.
Quote:
Originally Posted by mike2010
looks like nobody cares..
|
Yup, bored now.