[fpc-pascal] respawn a daemon in Linux
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Tue Jan 14 12:59:04 CET 2014
Michael Schnell wrote:
> On 01/14/2014 12:07 PM, Mark Morgan Lloyd wrote:
>> You need to make sure that it doesn't try to restart if it's received
>> a signal that the system's going down
>>
> I suppose the bash running the "loopmyprogram" script will get the kill
> signal, as well and stop right away.
They'll get a TERM first, and five seconds later a KILL. You don't want
to restart after that first signal, because if you wait until the second
one you risk leaving files etc. associated with the program in an
indeterminate state. I've had Qemu break a database inside NTFS by
refusing to honour a shutdown.
So you can't restart after a KILL, shouldn't after a TERM, might not
want to after an INT (which, as we were discussing a few days ago,
includes ^C from the keyboard) but probably do want to restart after a
HUP. At the very least, you need to make sure that your program
propagates why it's stopped to whatever's started it.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list