Update database backup script to connect to fritz
[clinton/scripts.git] / hcoop-all-db-backup
index 9db1b1d..1a1697f 100755 (executable)
@@ -6,16 +6,16 @@
 #
 
 BACKUP_ROOT=/var/backups/databases
-BACKUP_DAYS=7
+BACKUP_DAYS=2
 
 if ! test -d "$BACKUP_ROOT"; then
        echo "Backup root directory '$BACKUP_ROOT' inaccessible."
        exit 1
 fi
 
-MYSQL_DBS=`sudo -H mysqlshow | tail -n +4 | head -n -1 | cut -d' ' -f 2 | xargs`
+MYSQL_DBS=`sudo -H mysqlshow --defaults-file=/root/.my.fritz.cnf | tail -n +4 | head -n -1 | cut -d' ' -f 2 | xargs`
 echo "Mysql Databases are: $MYSQL_DBS"
-PGSQL_DBS=`sudo -u postgres psql template1 -c '\l' | tail -n +4 | head -n -2 | cut -d' ' -f 2 | xargs`
+PGSQL_DBS=`sudo -u postgres psql -h postgres template1 -c '\l' | tail -n +4 | head -n -2 | cut -d' ' -f 2 | xargs`
 echo "Postgres Databases are: $PGSQL_DBS"
 
 # Delete oldest