Search Postgresql Archives

Re: How to run a task continuously in the background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2019-07-11 at 11:19 -0500, Michael Nolan wrote:
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. 

If you run such a job under systemd you can tell systemd to automatically restart it if it dies.

Alternate, the application monit is an older means of monitoring and restarting persistent processes, complete with email notifications.

This is quite a common system administration task. No need to roll your own.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux