I'm trying to make a clean startup script for pgagent
I found one here that use start-stop-daemon :
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
I wanted to run this under the postgres user, because it's more appropriate and because it allows the command to get the password in the .pgpass file.
So, as the start-stop-demon doc says, I added
-c postgres:postgres in the call :
if start-stop-daemon -S -q -p /var/run/pgagent.pid -c postgres:postgres \ -x /usr/bin/pgagent "hostaddr=127.0.0.1 dbname=postgres user=postgres";then
But when I test my script with
sudo /etc/init.d/pgagent start, I still get the error showing that the .pgpass file is not used at all...
WARNING: Couldn't create the primary connection (attempt 1): fe_sendauth: no password supplied