Re: How to run a task continuously in the background

Поиск
Список
Период
Сортировка
От Alan Hodgson
Тема Re: How to run a task continuously in the background
Дата
Msg-id 927408b7f1a964134cea896d86db41b1ea0bd5ff.camel@lists.simkin.ca
обсуждение исходный текст
Ответ на Re: How to run a task continuously in the background  (Michael Nolan <htfoot@gmail.com>)
Список pgsql-general
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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Tim Clarke
Дата:
Сообщение: Re: Restore database into azure PostgreSQL
Следующее
От: Wayne Mell
Дата:
Сообщение: Postgresql and VBA - Connection Timeout