Pergunta

I have a problem to run pgAgent job for PostgreSQL 9.6 under ubuntu 16.04. The job is never executed.

I already configured .pgpass and added:

localhost:5432:*:postgres:mypass 

Also modified the permission for .pgpass:

$ touch ~/.pgpass
$ chmod 0600 ~/.pgpass

After that I run pgAgent with no problem:

$pgagent hostaddr=127.0.0.1 dbname=mydb user=postgres 

When I check the process for pgAgent I would get this result:

user@gis-srv:~$ ps aux | grep pgagent
user   153179  0.0  0.0 113844  9392 pts/26   S    17:15   0:00 pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres
user   153220  0.0  0.0 113844  9360 pts/26   S    17:16   0:00 pgagent hostaddr=127.0.0.1 dbname=mydb user=postgres
user   153227  0.0  0.0  12944   936 pts/26   S+   17:16   0:00 grep --color=auto pgagent

Here is my job setting:
Job Setting:
Job Setting
Schedule setting:
Schedule setting
Step Setting:
Step Setting

My propblen that the job is never executed and there is no error in the errors log for PostgreSQL. Please help me to find out why jobs never run.

I am receving the following errors: from postgres.log:

2017-11-03 16:01:32.269 EDT [15344] postgres@postgres LOG:  could not receive data from client: Connection reset by peer

from pgagent.log:

(attempt 9): fe_sendauth: no password supplied
Fri Nov  3 16:01:32 2017 : WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied
Fri Nov  3 16:01:32 2017 : ERROR: Stopping pgAgent: Couldn't establish the primary connection with the database server.

Also I modified the permission .pgpass to allow everyone to access it. (Just for testing)

Foi útil?

Solução

since you're specifying

pgagent hostaddr=127.0.0.1 dbname=mydb user=postgres

change .pgpass to match it

127.0.0.1:5432:*:postgres:mypass

or specify

*:5432:*:postgres:mypass

Edit: And change the permissions of .pgpass back to 0600 else you'll get the message:

WARNING: password file "~/.pgpass" has group or world access; permissions should be u=rw (0600) or less

and for command line, it prompts for password

Licenciado em: CC-BY-SA com atribuição
Não afiliado a dba.stackexchange
scroll top