Cum cerezi un script BASH pentru backup MYSQL care genereaza automat pe an/luna/zi

#!/bin/bash
BASE="/home/MYSQLBACKUP/"
MUSER="pastebin"
MHOST="localhost"
MPASS="pastebin"

BKDIR="$BASE$(date +"%Y/%m/%d/%H.%M")/"

MYSQLDUMP="$(which mysqldump)"
MYSQL="$(which mysql)"
GZIP="$(which gzip)"

echo -e "Backup MySQL Databases to: $BKDIR\n"
mkdir -m 700 -p $BKDIR

DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
if [ "$db" != "information_schema" ]; then
FILE=$BKDIR/$db.tgz
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
fi
done

Iar acum, fisierul este final (:

Hjalp dette svar dig? 16 Kunder som kunne bruge dette svar (203 Stem)