问题
Created a job using pgagent.
Successfully it got created but could not check its status if its running or not.
Neither it has performed its specified code which I have given in steps.
Verion Used: PostgreSQL 9.6.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17), 64-bit
With the help of pgAgent I have created a JOB
Job successfully got created but I cant check if its working or not as there is no notification for the same, neither it is performing the SQL code which i have passed in Job -> Step.
回答1:
If I got it right, you installed pgAagent but it is not starting when you execute the jobs. Have you tried starting it using the terminal? The service might be down (I do start it manually every time the database system is restarted).
Using the postgres user ...
sudo su - postgres
... execute the following command (assuming you're on the db server):
pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres -s pgagent_log.log
I hope it helps. Cheers!
回答2:
Maybe it'll be helpful to some windows users, because I faced the same issue recently.
to check run's statistic in pgadmin click at the your job and then select "statisctic" tab.
Second unclear thing to me is step's settings. I have the one server, so i thought I have to choose "local" connection type, but in didn't work. Even on the same machine try to select "remote", and then put connection string like:
host=localhost port=5432 dbname=YOUR_DB user=postgres password='asd@3wf!'
Please pay attention that for passwords which contain special symbols you have to set it in the ''.
回答3:
In my case the problem was that agent couldn't authorize to database and service hasn't been started, so after I've made all connections trusted from localhost the service started successfully and job works fine for more information about error you should see into windows event viewer or eq in unix based systemC:\Program Files\PostgreSQL\10\data\pg_hba.conf
来源:https://stackoverflow.com/questions/45670622/how-to-run-a-job-created-via-pgagent-in-postgres