1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

Use ExitType=cgroup for autostart generated services

This fixes a bug[1] with some generated autostart app services which
fork and exit immediately after main application process start,
that caused them not to launch during session startup, as the entire
cgroup was immediately killed by systemd.

This can also happen with apps such as file browsers, whose initial
process will exit after the window is closed, but who intend to leave a
daemon child running.

Since the forking model of a .desktop application cannot be known at
service generation time otherwise, ExitType=cgroup is the only effective
way to fix this bug.

[1] https://bugs.kde.org/show_bug.cgi?id=433299
This commit is contained in:
Henri Chain 2021-11-05 16:11:42 +01:00
parent 596e447076
commit e83a422797

View File

@ -597,6 +597,7 @@ int xdg_autostart_service_generate_unit(
fprintf(f, fprintf(f,
"\n[Service]\n" "\n[Service]\n"
"Type=exec\n" "Type=exec\n"
"ExitType=cgroup\n"
"ExecStart=:%s\n" "ExecStart=:%s\n"
"Restart=no\n" "Restart=no\n"
"TimeoutSec=5s\n" "TimeoutSec=5s\n"