[fpc-pascal] respawn a daemon in Linux

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Jan 14 12:07:46 CET 2014


Michael Van Canneyt wrote:

>> Does it exit in a sufficiently-controlled state that you could simply 
>> exec a new copy at the end of the finalization block? The available 
>> parameters should be accessible in /proc.
> 
> No need to modify the program. You can simply script it as
> 
> #!/bin/bash
> while [ 1 ]; do
>   yourprogram youroptions
> done

With caution. You need to make sure that it doesn't try to restart if 
it's received a signal that the system's going down because of a power 
failure etc., where the last thing you want is a daemon respawning 
wildly and wasting CPU time that would be much better spent shutting 
everything else down in a controlled fashion.

-- 
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