Skip to content

eriksjolund/systemd-restart-service-fdstore

Repository files navigation

systemd-restart-service-fdstore

Example systemd user service that uses FDSTORE=1

Status: Running on the host works ([email protected]). Running in a container with Podman fails ([email protected]). See #1.

Installation

git clone URL
cd systemd-restart-service-fdstore
gcc -o /tmp/server server_fdstore.c -l systemd
mkdir -p ~/.config/systemd/user
cp [email protected] ~/.config/systemd/user
cp [email protected]  ~/.config/systemd/user
systemctl --user daemon-reload
Systemctl --user start [email protected]

Usage

$ socat readline tcp4:127.0.0.1:3010
aaaaa
AAAAA
bbb
BBB
ccc
CCC
dddd
DDDD
eeeeeee
EEEEEEE
fffffff
FFFFFFF

The systemd user service [email protected] calls exit(EXIT_FAILURE) every nth time (n=3) it receives a string. systemd will then pass the previously stored accepted TCP socket when restarting the service. The client will not notice the restart because the TCP connections stays active.

In another shell run

journalctl  --user -xe -u [email protected]

to see the restarts happening.

Releases

No releases published

Packages

No packages published