[fpc-pascal] Stopping daemon in linux

Wimpie Nortje wimpienortje at gmail.com
Mon Nov 9 14:21:28 CET 2009



Joost van der Sluis wrote:
> On Mon, 2009-11-09 at 13:02 +0200, Wimpie Nortje wrote:
>   
>> 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?
>>     
>
> I don't know how I did it exactly, but I ahve this working properly in a
> production system. (Even created my own SysV init script for it. It
> should be generally usable for all fpc-daemon applications)
>
> But I did use fpc 2.3.1, so try the new 2.4.0rc1. And I think that it
> won't work always now I've read Jonas' mail about it. Maybe I'll look at
> that later.
>
>
>   
Thanks, I will try the new compiler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20091109/6f15f34f/attachment.html>


More information about the fpc-pascal mailing list