Score:0

How to start/restart of script after another service is ready?

gs flag

We use Supervisor to manage some PHP scripts that need to interact with a local MySQL server. This works well under normal operation when those PHP scripts themselves exit after error. But when system boots or after MySQL server crashes, because MySQL server needs a few minutes to boot, those PHP scripts will behave erratically when MySQL server is still booting.

My question is, is there a way to check whether MySQL service ready in Supervisor first then start/restart PHP scripts? If this cannot be done in Supervisor, can we do it with some other application?

There seems to be a way to manage this during system boot via systemd, basically don't start Supervisor itself until MySQL service is ready. But this doesn't handle MySQL crash/reboot after system boot.

Can anyone offer some pointers?

Thanks in advance, ZL

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.