From 38eaa16a8d7343b3a93186c385029dcb6cef52f5 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Wed, 3 Apr 2019 21:35:15 -0400 Subject: [PATCH] hcoop-all-db-backup: switch cwd to tmpdir postgres commands complain when they can't cwd to the current directory. --- hcoop-all-db-backup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hcoop-all-db-backup b/hcoop-all-db-backup index a3ba510..d0a9a10 100755 --- a/hcoop-all-db-backup +++ b/hcoop-all-db-backup @@ -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` -- 2.20.1