Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eriksjolund/systemd-restart-service-fdstore

Example systemd user service that uses FDSTORE=1
https://github.com/eriksjolund/systemd-restart-service-fdstore

container demo podman socket-activation systemd-service

Last synced: about 1 month ago
JSON representation

Example systemd user service that uses FDSTORE=1

Awesome Lists containing this project

README

        

# 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 https://github.com/eriksjolund/systemd-restart-service-fdstore/issues/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.