Modification : vm_{host,hosted,remote} -> {host,local,remote}/ .
[lhc/ateliers.git] / remote / mysql-backup
diff --git a/remote/mysql-backup b/remote/mysql-backup
new file mode 100755 (executable)
index 0000000..0879dfd
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -eu
+tool=$(readlink -e "${0%/*}/..")
+. "$tool"/remote/lib.sh
+
+mkdir -p "$tool"/var/backup/mysql
+"$tool"/remote/ssh -l backup '
+       for db in $(sudo -u backup mysql -u backup --skip-column-names <<-EOF
+               SELECT schema_name
+                       FROM information_schema.schemata
+                       WHERE schema_name NOT IN ("information_schema", "performance_schema");
+               EOF
+        ); do
+               echo $db
+        done
+ '