1 Answer
"Yes it is possible. Follow these steps:
To run your script as another user as one command, run:
/bin/su -c ""/path/to/backup_db.sh /tmp/test"" - postgres
Breaking it down:
/bin/su : switch user
-c ""/path/to..."" : command to run
- : option to su, make it a login session (source profile for the user)
postgres : user to become"
Your Answer