[Lazarus] Making a Linux systemd service, how does one handle the shutdown?
Michael Van Canneyt
michael at freepascal.org
Sun Jun 21 18:45:23 CEST 2020
On Sun, 21 Jun 2020, Bo Berglund via lazarus wrote:
> I have read that a systemd service on Linux will be taken down by the
> service manager using kill -TERM, i.e. the application is given a
> chance for a clean shutdown.
>
> So my question is:
> How/where do I implement a handler for the terminate message in a
> FreePascal console application (no GUI or form available)?
https://www.freepascal.org/docs-html/current/rtl/sysutils/hooksignal.html
or
https://www.freepascal.org/docs-html/current/rtl/baseunix/fpsigaction.html
You should install handlers for SIGQUIT/SIGTERM/SIGINT
The hooksignal internally uses fpsigaction, by the way.
Michael.
More information about the lazarus
mailing list