I have a program that fork()s and exits. Its child remains running for about 50 seconds, while it prints out messages each 5 seconds. When I run from a terminal it runs as expected, the parent exits, then the child prints 10 messages and exits too. I then created a systemd service unit with only this:
[Unit]
Description=Program that forks
Documentation=https://program5.example.com
[Service]
Type=forking
ExecStart=/root/fork
Apparently systemd works as it shows the main process active until the child exits, but checking journalctl or even looking at the program with systemctl status, the child messages on the screen only shows up after the child exits and the process is dead. Why is that?