Recent

Author Topic: Daemon in linux  (Read 15899 times)

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Daemon in linux
« on: February 07, 2010, 12:05:49 pm »
I want to convert a program to Linux Daemon, and I was searching for LazDaemon without luck.
where can I find this component or an equivalent.
Can this component by used for Windows NT service by lazaurs?
thanks

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Daemon in linux
« Reply #1 on: February 07, 2010, 01:14:05 pm »
I found it in lazarus\components\daemon

sorry for disturbance

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1891
Re: Daemon in linux
« Reply #2 on: February 07, 2010, 01:15:04 pm »
Look at:
Package -> Configure Installed Packages -> Available Packages -> lazdaemon 0.0

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Daemon in linux
« Reply #3 on: February 07, 2010, 02:14:48 pm »
I tried to create a new Daemon under Vista, also I tried cleandirs example,
when I tried to install it I get error in both cases:

Code: [Select]

C:\lazarus\examples\cleandir>cleandirs /install
exception at 00418782:
System error, (OS Code 5):
Access is denied.
.


DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: Daemon in linux
« Reply #4 on: February 07, 2010, 02:21:55 pm »
Quote
I tried to create a new Daemon under Vista, also I tried cleandirs example,
when I tried to install it I get error in both cases:
Did you run it as an administrator? You'll need that to get change services, etc.


motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Daemon in linux
« Reply #5 on: February 07, 2010, 08:09:15 pm »
In Windows:

I installed it with Administrator, then it has been installed and appear in Services page, then I can start/stop it.
But it seems that it do nothing, I have added a text file log in Execute of TDaemon action, also in thread's Execute, TDaemon's Start action, but the text file is not created.

Also in Linux I use cleandirs --run, but also I get nothing.

Execute procedure which fail to write the text file:

Code: [Select]
procedure TCleanDirsDaemon.CleanDirsDaemonExecute(Sender: TCustomDaemon);
var
  F: TextFile;
begin
  while status = csRunning do
  begin
    Sleep(1000);
    AssignFile(F, '/home/motaz/first.txt');
    if FileExists('/home/motaz/first.txt') then
      Append(F)
    else
      Rewrite(F);
    Writeln(F, DateTimeToStr(Now));
    CloseFile(F);
  end;
end;

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Daemon in linux
« Reply #6 on: March 25, 2010, 01:18:20 pm »
Does anybody success on writing daemon in Linux using Lazarus?

fredycc

  • Sr. Member
  • ****
  • Posts: 264
Re: Daemon in linux
« Reply #7 on: May 05, 2010, 03:50:05 pm »
Hi, I have the same problem with service I get nothing when the service start;  %). I try creating a text file, but nothis is created, I don't know why.

Lazarus 0.9.28.2 r22279 FPC 2.2.4 i386-win32-win32/win64
Windows 7 32 bits.

fredycc

  • Sr. Member
  • ****
  • Posts: 264
Re: Daemon in linux
« Reply #8 on: May 05, 2010, 07:35:53 pm »
After try and try again, I can execute my own service into windows 7 Ultimate & Xp Sp3 without problems and the file attched is based in (daemon.pp) file, I modified some lines and now the service appear into the service manager after install and the service create a file into C:\temp, you can modify it, I used it that path for tests reasons.  ;)

Tomorrow I'll test it for ubuntu.
« Last Edit: May 05, 2010, 08:43:26 pm by fredycc »

thierrybo

  • Full Member
  • ***
  • Posts: 136
Re: Daemon in linux
« Reply #9 on: June 01, 2010, 02:45:19 am »
After try and try again, I can execute my own service into windows 7 Ultimate & Xp Sp3 without problems and the file attched is based in (daemon.pp) file, I modified some lines and now the service appear into the service manager after install and the service create a file into C:\temp, you can modify it, I used it that path for tests reasons.  ;)

Tomorrow I'll test it for ubuntu.

Hi,

I tried you attached project on Windows XP SP3. The service install fine, however there is an error when I want to start it (translated):

Quote
Unable to start the daemon on Local Computer.
Error 3: The path specified is not found.

Any idea?

Sorry, I found. Project file was on a network drive  :)
« Last Edit: June 01, 2010, 02:48:10 am by thierrybo »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10175
  • FPC developer.
Re: Daemon in linux
« Reply #10 on: June 01, 2010, 09:40:45 am »
Hi, I have the same problem with service I get nothing when the service start;  %). I try creating a text file, but nothis is created, I don't know why.

Lazarus 0.9.28.2 r22279 FPC 2.2.4 i386-win32-win32/win64
Windows 7 32 bits.

Please try the most recent version.

thierrybo

  • Full Member
  • ***
  • Posts: 136
Re: Daemon in linux
« Reply #11 on: June 01, 2010, 04:01:22 pm »
without problems and the file attched is based in (daemon.pp) file,

Here is the same program creating a daemon visually. It works on Ubuntu and XP SP3 (change the path to the log file).

 

TinyPortal © 2005-2018