From: Clinton Ebadi Date: Thu, 4 Apr 2019 01:35:15 +0000 (-0400) Subject: hcoop-all-db-backup: switch cwd to tmpdir X-Git-Url: https://git.hcoop.net/hcoop/scripts.git/commitdiff_plain/38eaa16a8d7343b3a93186c385029dcb6cef52f5 hcoop-all-db-backup: switch cwd to tmpdir postgres commands complain when they can't cwd to the current directory. --- 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`