Re: How to run a task continuously in the background - Mailing list pgsql-general

From Michael Nolan
Subject Re: How to run a task continuously in the background
Date
Msg-id CAOzAquKb+O3iu0pVBonDDSS8SH=a4Wa4hmYFxAbTwUCi7Hxjhg@mail.gmail.com
Whole thread Raw
In response to RE: How to run a task continuously in the background  (Steven Winfield <Steven.Winfield@cantabcapital.com>)
Responses Re: How to run a task continuously in the background  (Alan Hodgson <ahodgson@lists.simkin.ca>)
Re: How to run a task continuously in the background  (Dirk Mika <Dirk.Mika@mikatiming.de>)
List pgsql-general
A cron job will only run once a minute, not wake up every second.  But you could write a PHP program that does a one-second sleep before checking if there's something to do, and a batch job that runs periodically to see if the PHP program is running, and if not, launch it. 

That's how I handle a job that opens a tunnel from our PostgreSQL server to a MySQL server running at AWS so we can synchronize data between those two database servers.  It dies periodically for reasons we've never figured out, so every 5 minutes I check to make sure it's running. 
--
Mike Nolan

On Thu, Jul 11, 2019 at 5:44 AM Steven Winfield <Steven.Winfield@cantabcapital.com> wrote:
pg_cron, perhaps?
https://www.citusdata.com/blog/2016/09/09/pgcron-run-periodic-jobs-in-postgres/

I _think_ it ticks all three of your boxes.


Steve.




This email is confidential. If you are not the intended recipient, please advise us immediately and delete this message. The registered name of Cantab- part of GAM Systematic is Cantab Capital Partners LLP. See - http://www.gam.com/en/Legal/Email+disclosures+EU for further information on confidentiality, the risks of non-secure electronic communication, and certain disclosures which we are required to make in accordance with applicable legislation and regulations. If you cannot access this link, please notify us by reply message and we will send the contents to you.

GAM Holding AG and its subsidiaries (Cantab – GAM Systematic) will collect and use information about you in the course of your interactions with us. Full details about the data types we collect and what we use this for and your related rights is set out in our online privacy policy at https://www.gam.com/en/legal/privacy-policy. Please familiarise yourself with this policy and check it from time to time for updates as it supplements this notice

pgsql-general by date:

Previous
From: Tony Shelver
Date:
Subject: Re: DRY up GUI wiki pages
Next
From: mahesh ravilla
Date:
Subject: Restore database into azure PostgreSQL