Pgagent startup script (under the postgres user)
- by Dominique Guardiola
Hello,
I'm trying to make a clean startup script for pgagent
I found one here but I don't see how I can change this :
if start-stop-daemon --start --quiet --pidfile /var/run/pgagent.pid \
--exec /usr/bin/pgagent "hostaddr=127.0.0.1 dbname=postgres user=postgres \
password=XXXXXXX";then
to launch something like this :
su - postgres -c /usr/bin/pgagent "hostaddr=127.0.0.1 dbname=postgres user=postgres"
in order to avoid to hard-code the PG password in the script.
This is possible using the .pgpass file feature. It works when I'm logged under the postgres user.
So my only problem left is how to launch this command under the postgres user
tried to add --user=postgres in the call, like mentioned here but it does not work.