0050_nextcloud_desktopclient: fix Nextcloud client killed on service exit

systemd-run --scope ... & left the systemd-run binary running as a
background process inside the autostart service's cgroup. When
logon_script.sh exited, systemd's KillMode=control-group sent SIGTERM
to all remaining cgroup processes, including systemd-run. systemd-run,
on receiving SIGTERM while monitoring a scope, stopped the scope and
killed the Nextcloud client -- at exactly the same moment the autostart
service ended.

--no-block with --scope is not supported. Switch to a transient service
unit (drop --scope, add --no-block). systemd-run registers the unit and
returns immediately, leaving the cgroup before logon_script.sh ends.
The Nextcloud process then runs as an independent systemd user service,
unaffected by the autostart service lifecycle. Tested: Nextcloud keeps
running after systemd-run exits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Brot der Bot
2026-05-01 17:13:41 +02:00
parent 93418748d7
commit c454110793
@@ -151,7 +151,7 @@ done
#fi #fi
# Now start Nextcloud # Now start Nextcloud
echo "Starting Nextcloud Client in Background" echo "Starting Nextcloud Client in Background"
systemd-run --user --scope --unit=nextcloud-client ${BASECMD} >${TEMPDIR}/nc_desktop_client.log 2>&1 & systemd-run --user --no-block --unit=nextcloud-client.service ${BASECMD} >>${TEMPDIR}/nc_desktop_client.log 2>&1
sleep 2 sleep 2
echo "Done Setup of Nextcloud." echo "Done Setup of Nextcloud."
exit 0 exit 0