How can I stop a long run pgAgent job?

Started by aalmost 8 years ago3 messagesgeneral
Jump to latest
#1a
372660931@qq.com

Hi

I'm using pgAdmin 4, pgAgent and postgresql 10 on windows server.

I tried a job but due to some reasons, its running long time. Is there a way that I can terminate it ??

Thanks

Shore

#2Fabio Pardi
f.pardi@portavita.eu
In reply to: a (#1)
Re: How can I stop a long run pgAgent job?

Hi Shore,

Have a look at:

https://www.postgresql.org/docs/current/static/functions-admin.html

'pg_terminate_backend' is probably what you are looking for

regards,

fabio pardi

Show quoted text

On 21/06/18 11:32, a wrote:

Hi�

I'm using pgAdmin 4, pgAgent and postgresql 10 on windows server.

I tried a job but due to some reasons, its running long time. Is there a way that I can terminate it ??

Thanks

Shore

#3Adam Brusselback
adambrusselback@gmail.com
In reply to: Fabio Pardi (#2)
Re: How can I stop a long run pgAgent job?

As said, terminating a backend is the current way to kill a job.

An alternative if this is something you do often:
https://github.com/GoSimpleLLC/jpgAgent
jpgAgent supports terminating a job by issuing a NOTIFY command on the
correct channel like this: NOTIFY jpgagent_kill_job, 'job_id_here';
It works well with windows, and all the existing pgAgent admin tools work
to manage it, it's just a drop in replacement for the agent portion.