hcoop-all-db-backup: switch cwd to tmpdir
authorClinton Ebadi <clinton@unknownlamer.org>
Thu, 4 Apr 2019 01:35:15 +0000 (21:35 -0400)
committerClinton Ebadi <clinton@unknownlamer.org>
Thu, 4 Apr 2019 01:35:15 +0000 (21:35 -0400)
postgres commands complain when they can't cwd to the current
directory.

hcoop-all-db-backup

index a3ba510..d0a9a10 100755 (executable)
@@ -13,6 +13,9 @@ if ! test -d "$BACKUP_ROOT"; then
        exit 1
 fi
 
+# change cwd; default will be /root which postgres user can't chdir into
+cd /tmp
+
 MYSQL_DBS=`sudo -H mysql -Bse 'show databases' | xargs`
 echo "Mysql Databases are: $MYSQL_DBS"
 PGSQL_DBS=`sudo -u postgres psql template1 -tAc 'SELECT datname FROM pg_database WHERE datistemplate = false;' | xargs`