I have a system service that is executed for selected users. Name is serv@<uid> (<uid> is UID of the user). I want to share user's resource limits with the service (place it into user-<uid>.slice) and I also want to use his permissions.
/etc/systemd/system/[email protected]
[Unit]
Description=My service for user %i
[Service]
Type=simple
ExecStart=/usr/local/bin/serv.sh
Restart=always
User=%i
Slice=user-%i.slice
SuccessExitStatus=0 255 SIGKILL SIGTERM
[Install]
WantedBy=multi-user.target
When the user logs out, the service is terminated using SIGTERM. Why isn't the service restarted? How can I set it up so the service will not be terminated?