could not start pgAgent due to log on failure

7.8k views Asked by At

I wanted to install pgAgent service on windows. Though it installs alright using the following command:

C:\Program Files (x86)\pgAdmin III\1.14>pgagent.exe INSTALL pgAgent -l2 -u postgres hostaddr=localhost port=5432 dbname=postgres user=postgres

the service does not start giving an error: Windows could not start pgAgent service on the local computer. Error 1069: The service did not start due to a logon failure.

The password is being provided using pgpass.conf file. The same password is being used by pgAdmin to logon to databases.

I have even tried by providing same password (as pgpass.conf) using -p option on the command line itself. It did not work either but error is different. On command line it says service could not be started. Service reported no error . However when I see logs in Control Panel/EventViewer following warning is shown:

Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied

and then an error:

Stopping pgAgent: Couldn't establish the primary connection with the database server.

If it could help, I downloaded pgAgent separately and placed pgAgent.exe in pgAdmin III/1.14 folder where libpq.dll also resides. I am using PostgreSQL 9.0, pgAdmin 1.14 and pgAgent 3.0.0

Can somebody please help me with this?

2

There are 2 answers

0
wazzz On BEST ANSWER

ok guys, i am able to solve the issue, by reinstalling PostgreSQL and then installing pgAgent with StackBuilder.

0
Aditya Kumar Ravikanti On

Go to pgAgent installation folder on windows and execute

C:\Program Files (x86)\pgAgent\bin>pgagent REMOVE pgAgent


This will remove the existing misconfigured windows service
then reinstall the service in the following way giving the password credentials properly. The first -u gives the postgres user created on windows and the second username in the connection string is the db username.
After doing the below start the service and check the Event Viewer if you still see the error.

C:\Program Files (x86)\pgAgent\bin>pgagent --help
Usage:
pgagent REMOVE <serviceName>
pgagent INSTALL <serviceName> [options] <connect-string>
pgagent DEBUG [options] <connect-string>
options:
-u <user or DOMAIN\user>
-p <password>
-d <displayname>
-t <poll time interval in seconds (default 10)>
-r <retry period after connection abort in seconds (>=10, default 30)>
-l <logging verbosity (ERROR=0, WARNING=1, DEBUG=2, default 0)>

C:\Program Files (x86)\pgAgent\bin>pgagent INSTALL pgAgent -u postgres -p admin
-l 2 hostaddr=127.0.0.1 port=5433 user=postgres dbname=first password=admin