1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-09-20 09:20:34 +00:00
puppet-rsnapshot/templates/mysql.sh.erb
2016-01-21 15:11:10 +01:00

17 lines
561 B
Plaintext

#!/bin/bash
# written by Norbert Varzariu <loomsen@gmail.com>
# This Script is triggered by rsnapshot and dumps the specified dbs on the configured host.
#
host=<%=@host%>
user=<%=@dbbackup_user%>
pass=<%=@dbbackup_password%>
dbs=( $(mysql -h "$host" -u "$user" -p"$pass" -e 'show databases' | sed '1d;/information_schema/d;/performance_schema/d') )
for db in "${dbs[@]}"; do
mysqldump --host="$host" --user="$user" --password="$pass" --single-transaction --quick --routines --ignore-table=mysql.event "$db" > "$db".sql
wait
pbzip2 -p3 "$db".sql
done