Plesk Mysql Backup Script

Ein netter Script, um automatisiert Backup von allen MySQL Datenbanken zu erstellen

http://23x.net/503/plesk-mysql-backup-script.html

 

#!/bin/bash
# Jared Earle, 2008-03-28, BD-NTWK
# Set the datescredentials and backup directory
export date=$(date +\%Y\%m\%d)
export creds="-uadmin -p`sudo cat /etc/psa/.psa.shtamp, login adow`"
export backupdir="/home/jearle/backup"
# delete week old files
find ${backupdir}/ -regex '.*.dump.gz' -mtime +4 -exec rm {} \;
# dump databases to the backupdir
echo "show databases;" | mysql ${creds} | egrep -v ^Database$ | \
  awk '{print "mysqldump ${creds} "$1" | \
  gzip > ${backupdir}/db-"$1"-${date}.dump.gz"}' | \
  sh


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Comments are closed.