0

I need a system template service with multiple (2) arguments to like this:

[Unit]
Description=Virtualgl Manager for slurm job <jobid>
After=user@<user>.service
Requires=user@<user>.service

[Service]
User=<user>
Type=oneshot
RemainAfterExit=yes
Slice=user-<user>.slice

I need to pass in both user and jobid. The jobid is needed so every slurm job has a unique instance but I also need to pass in the the jobs belongs to so the right user@.service is started. The goal of this service is to keep the user@.service alive for the duration of the slurm job like pam-systemd does for ssh sessions so the two can work in parallel.

I've seen systemd - Giving my service multiple arguments for a similar issue but those solutions only works for the service part, not the unit.

  • 1
    Have you considered running the service _within_ the per-user systemd instance instead? That way it'll already have the same lifetime as the user, and will only need the job ID. – u1686_grawity May 18 '21 at 09:46
  • Can a per-user instance be used before user@.service is running? Is it allowed to require a system instance to start that? – Goswin von Brederlow May 18 '21 at 14:52

0 Answers0