0

Let's say you have a systemd system unit:

[Unit]
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

[Service] Type=oneshot ExecStart=<start-user-unit-here>

[Install] WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

How can one start a user unit from this system unit?

Fabian T.
  • 111

1 Answers1

0
[Unit]
Description=Call user unit of %i

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --user --machine=%i@ start --wait <your-user-service-or-target>

Enable with <system-unit-name>@<your-user>.service.

I got this from this answer and just want to document. Credits to Daniel Pereira.

Fabian T.
  • 111