mysql datenbanken per shell script sichern
Jan-Benedict Glaw
jbglaw at lug-owl.de
Thu Apr 5 16:20:38 CEST 2007
On Thu, 2007-04-05 15:48:41 +0200, Thomas Balsfulland <tbals at ctrl-c.de> wrote:
> ich denke die hilfsdatei "db_test" kannste dir auch noch sparen:
>
> mydate=`/bin/date +%Y%m%d-%H%M`
> declare db
>
> db=` mysql << eof
> show DATABASES;
> eof`
>
> db=`echo $db |sed -e 's/Database//' | sed 's/test//'`
>
> for i in $db; do
> mysqldump --opt $i > backup_${i}_${mydate}.sql;
> done
mydate="`/bin/date +%Y%m%d-%H%M`"
for i in `echo "show DATABASES;" | mysql | sed -e 's/Database//' -e 's/test//'`; do
mysqldump --opt "$i" > "backup_${i}_${mydate}.sql"
done
MfG, JBG
--
Jan-Benedict Glaw jbglaw at lug-owl.de +49-172-7608481
Signature of: Friends are relatives you make for yourself.
the second :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20070405/700a659a/attachment.sig>
More information about the Linux
mailing list