[fpc-pascal] Stopping daemon in linux

Wimpie Nortje wimpienortje at gmail.com
Mon Nov 9 12:02:06 CET 2009



Michael Van Canneyt wrote:
> It should stop the daemons properly. This is the code that gets executed:
>
> Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : 
> PSigContext);
> cdecl;
>
> begin
>   Application.StopDaemons(True);
>   Application.Terminate;
> end;
>
> If it doesn't, something is wrong :(
I think something is wrong. :(

For my TDaemon descendant I assigned the following events:
OnDestroy
OnExecute
OnPause
OnShutdown
OnStart
OnStop

When I type "./daemon -r &"
The following handlers are executed:
1. OnStart
2. OnExecute

When I type "kill -TERM daemon_pid"
The following handler is executed
1. OnDestroy

I am also a bit confused by the wiki. According to the wiki Start and 
stop are triggered under linux but shutdown is not. The 'Taming the 
daemon' article does not specify which of these 3 are called under linux.

As I mentioned earlier, I use FPC 2.2.4. Could that be the problem?



More information about the fpc-pascal mailing list