1

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)

5
  • what is the question? Commented Nov 2, 2017 at 21:48
  • @Evan 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.
    – Eyla
    Commented Nov 2, 2017 at 21:59
  • Try specifying the ‘-s </path/to/pgagent.log>’ option when starting pgagent. I’m going to assume the ‘asselect’ code just looks funny in the image, else that will definitely raise a syntax error.
    – amacvar
    Commented Nov 3, 2017 at 2:54
  • @Evan I am getting this error from pgagent log Fri Nov 3 13:20:54 2017 : WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied Fri Nov 3 13:20:54 2017 : ERROR: Stopping pgAgent: Couldn't establish the primary connection with the database server.
    – Eyla
    Commented Nov 3, 2017 at 17:28
  • As I mentioned I already setup .pgpass with required information
    – Eyla
    Commented Nov 3, 2017 at 17:31

1 Answer 1

2

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

8
  • I updated .pgpass to :5432::postgres:mypass and change the permissions for others to Read and write and I am still getting error as Wed Nov 8 16:55:44 2017 : WARNING: Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied Wed Nov 8 16:55:44 2017 : ERROR: Stopping pgAgent: Couldn't establish the primary connection with the database server.
    – Eyla
    Commented Nov 8, 2017 at 22:01
  • It has to be *:5432:*:postgres:mypass and not 5432::postgres:mypass permission on the file should be -rw------
    – amacvar
    Commented Nov 8, 2017 at 22:37
  • sorry that was typo I added what you what you wrote :5432::postgres:mypas and change permission to -rw------ and same result
    – Eyla
    Commented Nov 9, 2017 at 20:43
  • 1
    I've setup a ubuntu server, and i get Failed to query jobs table!. I will try and create a job later. Can you try one more thing please? export PGPASSWORD=mypass; pgagent -s pgagent.log ho...
    – amacvar
    Commented Nov 13, 2017 at 21:27
  • And sorry but i have to ask, I'm assuming the psql command is not working either? psql 'hostaddr=127.0.0.1 dbname=mydb user=postgres'
    – amacvar
    Commented Nov 14, 2017 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.