Translating --machine parameter to a service file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I want to run a script invoked by udev to run a pactl script. I am now using a udev rule SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/my_script"

which calls (drew is my username):
systemctl --machine=drew@.host --user --now my.service


which has:
[Service]
Type=oneshot
ExecStart=/usr/local/bin/my_script.py

and in the my_script.py, I do what I need. I cannot call my_script.py directly from the udev rule because, if I understood it correctly, scripts triggered
by udev run in a limited environment and pactl runs as user.

Needless to say, this feels rather hackish. Ideally I would use something like TAG+="systemd", ENV{SYSTEMD_WANTS}="my.service"

I can specify "User=" in the service file but I could not figure out
to translate the --machine=drew@.host parameter to it.


Is there a way to do this or am I just missing what --machine is for?
Kind regards,
Tomas


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux