Daemon on Debian lazarus / 32-Linux ---------------------------------------------------------------------- SymbolicFrank · 2016-03-30 15:02 I created a daemon, downloaded and configured the debian-service.sh script from the wiki, put everything in the right location, and I get the following error: Code: [Select]Failed to start r2server.service: Unit r2server.service failed to load: No such file or directory. The script is : /etc/init.d/r2server.sh, so I don't understand the ".service" part. I changed the file name to r2server.service.sh, but that didn't help. What am I doing wrong? ---------------------------------------------------------------------- Thaddy · 2016-03-30 15:32 Did you start it with sufficient rights? (like as root to debug) ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 07:14 I think so, I do: Code: [Select]sudo service r2server start ---------------------------------------------------------------------- mdalacu · 2016-03-31 09:28 Have you used the Fedora example? Now Ubuntu and Debian are using systemd. ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 09:40 Ah, thanks. I didn't know that. Last time I managed a Debian server it still used init.d. Will fix. ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 09:56 Yes, that did the trick. I have changed the wiki. ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 11:31 I spoke too soon. It seems to work, as in: it doesn't give an error, but the daemon isn't active. I wrote multiple servers in Lazarus, but this is the first time that I try to make it into an official daemon. So the code that listens to the socket and spawns the worker threads, should work. The wiki is sparse with information, so I followed the pdf. But that didn't work, either. I have no idea how I can debug it. I think I'll have to go back to a simple console application. Edit: I'll try and change the template code to match the pdf. Edit2: Code: [Select]./r2configserver --run Exception at 000000000042B80A: EStreamError: Failed to initialize component class "TMyMapper": No streaming method available. TMyMapper is the TDaemonMapper. Edit3: I cannot get it to work, so I redid it as a console application. That works flawless. ---------------------------------------------------------------------- Thaddy · 2016-03-31 13:53 Quote from: SymbolicFrank on March 31, 2016, 01:31:20 pm I have no idea how I can debug it.use application.log to write debug information. Quote from: SymbolicFrankEdit3: I cannot get it to work, so I redid it as a console application. That works flawless. Are you using write/writeln? The standard daemon doesn't provide stdin/stdout by itself. You should extend your Daemon with one or more  FILE or TEXTFILE objects to provide input/output streaming, yiu know assignfile, rewrite, etc. Then you can do write(myfile,'whatever'); Note on linux a device is also a file, so this also works for streaming to/from a device, e.g. a socket. ---------------------------------------------------------------------- SymbolicFrank · 2016-04-01 14:19 I have a logger build in, but it crashes on the initialization of the components. So there is a single line in the log: "Started", and then the daemon crashes before any more of my code executes. I assume there is something like a .frm or such file included in the executable as a resource, and that it tries to create those components by reading that resource. And that it crashes there.