mysqldumpシェル

コマンド:
#!/bin/sh
if [ -z “$QUERY_STRING" ]
then
echo “Content-type: text/html"
echo
echo “Dump a database
"
for db in `echo “show databases" | mysql -uXXXX -pXXXXX`
do
if [ “$db" != “Database" ]
then
echo “Dump : $db
"
fi
done
else
echo “Content-type: application/x-sql"
echo “Content-Disposition: attachment; filename=$QUERY_STRING-`date +%Y%m%d%H%M%S`.sql"
echo
mysqldump -uXXXX -pXXXXX $QUERY_STRING
fi

Source

Posted by arkgame