You are not logged in.

#1 2024-05-30 05:06:10

FishBoneEK
Member
Registered: 2023-09-26
Posts: 57

[SOLVED] systemd: Make user service depend on system target?

I'm trying to make some system and user services run when I create a WIFI access point. I'm doing it by adding some NetworkManager dispatcher scripts that will do `systemctl start wlan-ap.target` when the AP is up. Then I let my custom system and user services depend on the `wlan-ap.target` by `WantedBy=wlan-ap.target`.

But when I `systemctl --user enable foo.service`, which depends on `wlan-ap.target`:

Unit /home/fishbone/.config/systemd/user/foo.service is added as a dependency to a non-existent unit wlan-ap.target.

I can guess systemd is recognizing `wlan-ap.target` as a user target?

Last edited by FishBoneEK (2024-05-30 10:12:24)

Offline

#2 2024-05-30 07:21:42

seth
Member
Registered: 2012-09-03
Posts: 62,801

Offline

#3 2024-05-30 10:12:05

FishBoneEK
Member
Registered: 2023-09-26
Posts: 57

Re: [SOLVED] systemd: Make user service depend on system target?

Cool, thanks seth
Guess I will need to try another approach

Offline

#4 2024-05-30 15:53:12

seth
Member
Registered: 2012-09-03
Posts: 62,801

Re: [SOLVED] systemd: Make user service depend on system target?

There're a couple of approaches in the linked SE thread.
(You can also cut out the middleman and just use a foo@.service that runs some user specific script in a defined location and as that UID)

Offline

Board footer

Powered by FluxBB