DaemonSystemdInstallerUnit lazarus / 66-Unix ---------------------------------------------------------------------- Чебурашка · 2022-12-28 16:48 Hello, the unit DaemonSystemdInstallerUnit mentioned in https://wiki.freepascal.org/Daemons_and_Services that is supposed to create the systemd control files, is also part of the deamon stuff units or is it a custom unit belonging to the writer of the article? I did not find in my filesystem. ---------------------------------------------------------------------- Thaddy · 2022-12-28 17:52 That wiki entry is ,well, not very good. Stick with: from the official FPC documentation here: https://www.freepascal.org/docs- html/current/fcl/daemonapp/tdaemoncontroller.html The example in the fcl-extra directory here: packages\fcl-extra\examples and this article by Michael van Canneyt here: https://www.freepascal.org/~michael/articles/#daemons (also covers Windows services) and ignore the wiki. (well, it is not that bad and may help you a bit when you first read and understand official sources). The wiki is an abberation of "components" where there need not be components at all, just classes. You can just as well turn 'Hello, World' into a component < sigh>, but OTOH it may be that Michael also contributed a bit to the wiki to keep at least some control... (And yes, Michael's articles are an official source) ---------------------------------------------------------------------- Чебурашка · 2022-12-29 08:34 Quote from: Thaddy on December 28, 2022, 06:52:11 pmThat wiki entry is ,well, not very good. Stick with: from the official FPC documentation here: https://www.freepascal.org/docs- html/current/fcl/daemonapp/tdaemoncontroller.html The example in the fcl-extra directory here: packages\fcl-extra\examples and this article by Michael van Canneyt here: https://www.freepascal.org/~michael/articles/#daemons (also covers Windows services) and ignore the wiki. (well, it is not that bad and may help you a bit when you first read and understand official sources). The wiki is an abberation of "components" where there need not be components at all, just classes. You can just as well turn 'Hello, World' into a component < sigh>, but OTOH it may be that Michael also contributed a bit to the wiki to keep at least some control... (And yes, Michael's articles are an official source) Thanks, in reality I had no problem in writing a deamonized application (and as you say I did it just looking at the sources/pdfs). Only now I also need this deamon to get along with systemd and I was wondering if the cited unit is public or not, so that I don't have to create a custom tool to generate systemd configuration files. From your answer I understand it is not public. ---------------------------------------------------------------------- dbannon · 2022-12-29 09:00 The content you are looking for (I think) is in an example included with trunk but not yet the release versions of Lazarus. If you are not using Trunk, the content can be found here - https://gitlab.com/dbannon/laz_examples/-/tree/main/General/TDaemon Davo ---------------------------------------------------------------------- Чебурашка · 2022-12-29 09:06 Quote from: dbannon on December 29, 2022, 10:00:23 amThe content you are looking for (I think) is in an example included with trunk but not yet the release versions of Lazarus. If you are not using Trunk, the content can be found here - https://gitlab.com/dbannon/laz_examples/-/tree/main/General/TDaemon Davo Thank you. ---------------------------------------------------------------------- AlexTP · 2022-12-29 09:41 Added the found URL to the wiki topic. ---------------------------------------------------------------------- Чебурашка · 2022-12-29 10:28 At the end what I did was: - make the daemon (easy, just see the examples) - create a systemd config file and make sure to have: Code: INI  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [Unit]Description=TT daemon [Service]Type=forkingWorkingDirectory=/hom e/user_tt/.tt_daemonExecStart=/usr/local/bin/tt_daemon -r -bUser=user_ttGroup=users   - the option -r in the ExecStart line tells the daemon to run - the option -b in the ExecStart line tells the daemon created with fpc to daemonize itself = fork and become background process - the Type=forking is designed to deal with processes capable of daemonizing in alternative Code: INI  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [Unit]Description=TT daemon [Service]Type=simpleWorkingDirectory=/home /user_tt/.tt_daemonExecStart=/usr/local/bin/tt_daemon -rUser=user_ttGroup=users   - skip the option -b in the ExecStart so that the daemon will start and not daemonize itself (it will keep runnig until stopped from outside or it crashes) - in this case I have to use Type=simple (is the default) which is designed to deal with processes that do not daemonize, and systemd will go ahead with other services without being locked by my process.