This repository was archived by the owner on Dec 14, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ echo " Dumping databases to Parrot database folder."
4+ echo " "
5+ echo " This will overwrite any existing data."
6+
7+ BACKUP_DIR=" /vagrant_databases"
8+ MYSQL_USER=" root"
9+ MYSQL=/usr/bin/mysql
10+ MYSQL_PASSWORD=" root"
11+ MYSQLDUMP=/usr/bin/mysqldump
12+
13+ databases=` $MYSQL --user=$MYSQL_USER -p$MYSQL_PASSWORD -e " SHOW DATABASES;" | grep -Ev " (parrot|Database|information_schema|mysql)" `
14+
15+ for db in $databases ; do
16+ echo " Dumping $db to $BACKUP_DIR /$db .sql"
17+ $MYSQLDUMP --force --user=$MYSQL_USER -p$MYSQL_PASSWORD --quick --single-transaction --databases $db > " $BACKUP_DIR /$db .sql"
18+ done
19+
20+ echo " All databases exported."
Original file line number Diff line number Diff line change 4040 # Puppet magically turns our array into lots of resources.
4141 parrot_mysql::database_import { $db_names: }
4242
43-
43+ file {'/var/parrot-dump-databases.sh' :
44+ ensure => file ,
45+ source => ' puppet:///parrot_mysql/parrot-dump-databases.sh' ,
46+ mode => 755,
47+ }
4448
4549}
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Change to the directory that this script is stored in.
4+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
5+
6+ cd $DIR
7+
8+ # Ensure that the VM is up.
9+ vagrant up
10+
11+ # And run the script in the VM.
12+ vagrant ssh --command ' /var/parrot-dump-databases.sh'
You can’t perform that action at this time.
0 commit comments