k0lter / autopostgresqlbackup

Automated tool to make periodic backups of PostgreSQL databases
52 stars 17 forks source link

using "su -" instead of su #4

Closed maxadamo closed 3 years ago

maxadamo commented 3 years ago

When this script was run from crontab I was getting the error below. It was happening, because su does not initialize the environment variables for the user (in this case $HOME). Switching to su - solved the problem for me.

could not change directory to "/root": Permission denied
could not change directory to "/root": Permission denied
could not change directory to "/root": Permission denied
could not change directory to "/root": Permission denied
could not change directory to "/root": Permission denied
could not change directory to "/root": Permission denied