2

OS: Windows 10

PostgreSQL 11.4

I Installed PgAgent with Stackbuilder setup.

In Windows services; PostgreServer service is running. However, the pgAgent service is stopped. When I try to start pgAdmin service from there I get this error message:

The PostgreSQL Scheduling Agent - pgAgent service on Local Computer started and then stopped. 
Some services stop automatically if they are not in use by other services or programs. 

I have the pgAgent service to log On As -->LocalSystem (Note, I have also tried to change it to an windows administrator account)

When opening pgAdmin 4 I can see the pgAgent Jobs tab as well as create jobs.

Acording to the description on this page ,one should create an extension as well. However, when pgAgent was installed , there wasen't copied any extension files to %\PostgreSQL\11\share\extension so I can not create the extension in pgAdmin

Any advice on how I get the pgAgent service to run my jobs I have createn in pg Admin?


EDIT: On This thread They state that editing pgpass.conf in c:/user/user/AppData/postgresql helped. I have no such folder nore file. The only postgres related folders I've found under C:\Users is C:\Users\user\AppData\Roaming\pgAdmin


EDIT2:

  • I opened CMD as an admin and run cd %APPDATA% to find correct folder.

  • I created the pgpass.conf inside newly created folder postgresql in appdata --> C:\Users\user\AppData\Roaming\postgresql\pgpass.conf.

  • I added that file as a system variable PGPASSFILE (Source1 and Source2).

That did not change anything either.

Cholud I do some editting in REDEDIT? Source3


2
  • Please don't put "solved" into the title. Add your solution as an answer, then accept that answer. Otherwise your question will remain "open". It is perfectly OK to answer your own question and accept that answer.
    – user1822
    Sep 13, 2019 at 5:44
  • @a_horse_with_no_name Thanks, for the input. I added the "answer" now. However, apparently I have to wait 8 hours to accept as an answer Sep 13, 2019 at 5:49

1 Answer 1

1

I'm not sure what I did, but I have the service running now. I guess it is a combination of little of everything

  • Open CMD as administrator

  • browse to pgagent.exe

    • cd C:\Program Files\PostgreSQL\pgAgent\bin
  • Remove the pgAgent service (if pgAgent service is installed, but does not work)

    • pgAgent REMOVE pgAgent
  • Then I installed the service again.

    • pgAgent INSTALL pgAgent -u WindowsUser -p WindowsPassword hostaddr=127.0.0.1 dbname=postgres user=postgres password=postgePassword
  • (Not sure if the following steps are needed but) Open Windows services

  • There you can confirm the windows account that runs the service.

  • open up pgpass.conf in %APPDATA/postgresql and add the line

    • 127.0.0.1:5432:*:windowsUsername:windowsPassword
  • add pgpass.conf as system variable PGPASSFILE

Your Answer

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

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