[fpc-pascal] Daemon - OnStop and OnDestroy events never fired?

Krzysztof dibo20 at wp.pl
Mon Mar 4 13:42:33 CET 2013


Hi,

I have daemon on Linux Mint 14 64bit which working fine, but I noticed that
OnStop and OnDestroy events are never fired. I created simple test which
write to syslog and create file in my home directory:

procedure TTestDaemon.DataModuleStop(Sender: TCustomDaemon; var OK:
Boolean);
var sl: TStringList;
begin
  sl := TStringList.Create;
  try
    sl.Add('test');
    sl.SaveToFile('/home/dibo/s.txt');
  finally
    sl.Free;
  end;
  Application.Log(etInfo, 'Stopping');
end;

procedure TTestDaemon.DataModuleDestroy(Sender: TObject);
var sl: TStringList;
begin
  sl := TStringList.Create;
  try
    sl.Add('test');
    sl.SaveToFile('/home/dibo/d.txt');
  finally
    sl.Free;
  end;
  Application.Log(etInfo, 'destroying');
end;

But these event doesn't add logs in syslog, text file in home directory
isn't created also. Is linux blocking disk writting when stopping service?
There is also OnShutDown event which is working fine (I finally moved my
"clean" methods to this event) but I'm wondering why mentioned events are
not fired?

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130304/22285760/attachment.html>


More information about the fpc-pascal mailing list