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?

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .