[fpc-pascal] respawn a daemon in Linux

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Jan 14 11:26:54 CET 2014


Michael Schnell wrote:
> Hi Linux Experts.
> 
> Since years I am running an fpc program as a kind of daemon on a PC 
> Linux server.
> 
> I simply defined a "respawn" line in /etc/inittab and with any start of 
> the server, the program happily automatically runs as a daemon.

> I would appreciate any idea on how to create some kind of "respawn" 
> algorithm within this program or with a second program - maybe just a 
> script. In fact I could use "cron" for this, as happily the system does 
> allow me to edit crontab (which here actually is /etc/config/crontab and 
> the /etc/config/ is symlinked to a directory residing in a special 
> location on a hard disk.

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.

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