[Lazarus] Linux service
Michael Van Canneyt
michael at freepascal.org
Wed Nov 27 15:06:59 CET 2013
On Wed, 27 Nov 2013, Patrick Chevalley wrote:
> To enable your program to react to signal you need to use fpSigAction.
> See here for usage: http://www.freepascal.org/docs-html/rtl/baseunix/fpsigaction.html
> Instead of SigUsr1 in the example you can register a procedure for SIGTerm to handle a termination request.
> You can also add a procedure for SIGHUP if you want to implement a "service .. reload" action.
> The complete list of signal is in rtl/linux/signal.inc
That is exactly what the daemon code does.
Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl;
old,new : SigactionRec;
fpSigaction(SIGQUIT, at New, at Old);
fpSigaction(SIGTERM, at New, at Old);
fpSigaction(SIGINT, at New, at Old);
More information about the Lazarus