PostgreSQL: Cannot change directory to /root
Try this: Re: could not change directory to "/root":
Apparently you did "su postgres" from the root account, so you're still in root's home directory. It'd be better to do "su - postgres" to ensure you've acquired all of the postgres account's environment. Reading "man su" might help you out here.
For me this did the trick, pay attention to quotes (')
sudo -Hiu postgres 'pg_dump --column-inserts --data-only --table=someTable entities_db > /var/backups/anywhere/$(date +%Y%m%d_%H%M%S)_someTable.sql'
Note the -Hiu
for sudo, or use su - postgres
you can also put that in a cronjob for root with crontab -e