Forum > Beginners
[Linux] Program that runs in the background
abdoun.brahim:
Hello
I want to create a Lazarus Linux program in console mode that will run in the background (without seeing the result on the screen): it is a program that will run in the background and that will play on the serial port; the traces of communications will be recorded in a log file and the data captured in a PostgreSQL database.
Thank you for your help.
winni:
Hi!
What you want is called a daemon
Read this:
https://wiki.lazarus.freepascal.org/Daemons_and_Services
Winni
abdoun.brahim:
Hello
Thank you very much I will look at the links.
Thank you
MarkMLl:
In addition to what Winni's said, I'd remind you that Lazarus can be used to develop a non-GUI program that can simply be started with its standard handles defined as /dev/null i.e. like
--- Code: ---./something >/dev/null 2>&1 &
--- End code ---
MarkMLl
dbannon:
--- Quote from: MarkMLl on May 11, 2022, 10:43:25 pm ---
--- Code: ---./something >/dev/null 2>&1 &
--- End code ---
--- End quote ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---nohup ./something
Is my preferred means, it disconnects the current terminal so closing that terminal does not shut down the app, it redirects std out to a file called 'nohup'. For all intents and purposes, its a daemon.
But you could also look at https://wiki.freepascal.org/Daemons_and_Services for a more structured approach.
Davo
Navigation
[0] Message Index
[#] Next page