Add 'original.sh'
Original version, written by John Donath
This commit is contained in:
parent
377dd67450
commit
3ca0aa6558
28
original.sh
Normal file
28
original.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
USER=<user>
|
||||
PASS=<pass>
|
||||
COPIES=2
|
||||
#BASE=/var/myexport
|
||||
BASE=/tmp
|
||||
DBLIST=`mysql -u $USER --password=$PASS -s -e 'show databases'`
|
||||
for N in $DBLIST;
|
||||
do
|
||||
case $N in
|
||||
"Database")
|
||||
echo "ignoring Database"
|
||||
;;
|
||||
"information_schema")
|
||||
echo "ignoring Information_Schema"
|
||||
;;
|
||||
*)
|
||||
echo "dumping $N"
|
||||
i=$(($COPIES - 1))
|
||||
while [ $i -ge 0 ];
|
||||
do
|
||||
[ -s $BASE/$N.sql.$i.gz ] && mv $BASE/$N.sql.$i.gz $BASE/$N.sql.$(($i+1)).gz
|
||||
i=$(($i-1))
|
||||
done
|
||||
mysqldump -u $USER --password=$PASS $N | gzip >$BASE/$N.sql.0.gz
|
||||
;;
|
||||
esac
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user