Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

alt

Daniel Nashed

A closer look at Linux Systemd

Daniel Nashed – 14 May 2024 07:27:58

Long time ago Linux switched from init.d scripts to the new systemd service.

Today systemd is the standard for most Linux servers. But it is still a mystery for many admins.
Systemd is much more than a simple replacement. But this also makes it a bit more complex.


I had to look into systemd to stop, update and start a server with an application and ran into a couple of interesting details and useful commands.


The following information uses the Domino Start Script systemd service for reference.

For more details about systemd check the main man page of the project --> https://www.freedesktop.org/software/systemd/man/latest/systemctl.html

-- Daniel



Listing systemd scripts


The Domino Start script is a systemd script and uses a well defined service.

Service files can be listed with a single command:


systemctl cat domino.service


Description=HCL Domino Server (notes)

After=syslog.target network.target


[Service]

User=notes

RuntimeDirectory=notes

RuntimeDirectoryPreserve=yes

PIDFile=/run/notes/domino.pid

ExecStart=/opt/nashcom/startscript/rc_domino_script start

ExecStop=/opt/nashcom/startscript/rc_domino_script stop

Type=forking

LimitNOFILE€000

LimitNPROC€00

TasksMax€00


TimeoutSec=600

TimeoutStopSec=300

RemainAfterExit=no



Checking properties of a systemd service


The Domino Start script is a systemd script and uses a well defined service.
But only uses a fraction of the available configuration options.
To list the complete configuration including some status like the current main PID, there is a show command:


systemctl show domino.service


To query just one setting the --property option is useful


systemctl show domino.service --property PIDFile

systemctl show domino.service --property MainPID=24334




Systemd Services use Control Groups (cgroups)


When starting a service the main process and all child processes are assigned to the same cgroup as you can see from the following output.


Tip:
systemd-cgls -u domino.service shows the Domino service only

All child processes are always part of the same cgroup. On shutdown systemd takes care of cleaning up processed, if not terminated correctly.
A future start of the service requires all previous processes to be terminated.



systemd-cgls


Control group /docker/85b1e6835ef25a9e71ceec49c04849102436f23a9030f017e95a694dfa3647e4:

-.slice

├─20158 bash

├─25761 systemd-cgls

├─25762 (pager)

├─init.scope (#601)

│ └─1 /sbin/init

└─system.slice (#614)

 ├─dbus-broker.service (#835)

 │ → user.invocation_id: 88585e258446434cac7d034f53a92d94

 │ → trusted.invocation_id: 88585e258446434cac7d034f53a92d94

 │ ├─10648 /usr/bin/dbus-broker-launch --scope system --audit

 │ └─10649 dbus-broker --log 4 --controller 9 --machine-id 8b3fdf8329b14614896d034706fba6d4 --max-bytes 536870912 --max-fds 4096 --max-matches 16384 --audit

 ├─domino.service (#2252)

 │ → user.invocation_id: c7e98a3ae0fe4856a082f1e7afb9f99f

 │ → trusted.invocation_id: c7e98a3ae0fe4856a082f1e7afb9f99f

 │ ├─24334 /bin/bash /opt/nashcom/startscript/rc_domino_script start

 │ ├─24391 /opt/hcl/domino/notes/latest/linux/server

 │ ├─24399 /opt/hcl/domino/notes/latest/linux/logasio NOTESLOGGER reserved

 │ ├─24407 /opt/hcl/domino/notes/latest/linux/event

 │ ├─24435 /opt/hcl/domino/notes/latest/linux/amgr -s

 │ ├─24436 /opt/hcl/domino/notes/latest/linux/adminp

 │ ├─24438 /opt/hcl/domino/notes/latest/linux/certmgr

 │ ├─25296 /opt/hcl/domino/notes/latest/linux/amgr -e 1

 └─systemd-journald.service (#692)

   → user.invocation_id: 43b26fdee15c48938fcbce780d931c8e

   → trusted.invocation_id: 43b26fdee15c48938fcbce780d931c8e

   └─19 /usr/lib/systemd/systemd-journald



Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]