Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-02

Simple daemon on linux does nothing

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

I'm reading this article about services:
http://wiki.freepascal.org/Daemons_and_Services

I have created onStart event which should create text file in my home directory but nothing happens:

procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var Ok: Boolean);
var
  sl: TStringList;
begin
  sl := TStringList.Create;
  try
    sl.Add('test');
    sl.SaveToFile('/home/dibo/test.txt');
  finally
    sl.Free;
  end;
end;

My run script return: Starting test Service: [OK]
And I see my service by command: ps aux
I also created DaemonDef for my TDaemon1 class. What I'm missing?

Lazarus stable release 1.0.6
FPC stable 2.6.0
Linux Mint (debian) 64bit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130225/6e957e66/attachment.html>

Reply by email

Krzysztof
to Michael Van Canneyt

I attached simple project. Run script included (based on script from lazarus wiki). Change paths in this script and also change output file path in TDaemon1 class.
I copied "run_my_service.sh" script into /etc/init.d/ and then: sudo service run_my_service.sh start

Seems that starting and stopping is working fine but test.txt doesn't appear -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130225/9b77c430/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: test_service.zip
Type: application/zip
Size: 4928 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130225/9b77c430/attachment.zip>

Reply by email

Michael Van Canneyt
to Krzysztof
Krzysztof wrote 6 lines
I attached simple project. Run script included (based on script from lazarus wiki). Change paths in this script and also change output file path in TDaemon1 class. I copied "run_my_service.sh" script into /etc/init.d/ and then: sudo service run_my_service.sh start Seems that starting and stopping is working fine but test.txt doesn't appear

If you run it, you'll see that in syslog errors appear:

Feb 25 15:52:52 home test_service: [Error] Access violation

Michael.

Reply by email