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
man start-stop-daemonsuggests that you want--chuid postgres. Do you get any error messages? – geirha Mar 7 '11 at 6:56env > /tmp/env.output, then ran that using a similar line:sudo start-stop-daemon -S -q -c tmpuser:tmpuser -x /usr/local/bin/tmpscriptand in /tmp/env.output, the HOME environment variable was set to tmpuser's homedir. – geirha Mar 8 '11 at 15:59