You are not logged in.

#1 2014-08-19 00:11:03

captaincurrie
Member
From: /dev/random
Registered: 2013-11-01
Posts: 82

[Solved] systemd - can user units depend on system units

Hello,

I'm trying to define a Wants dependency between some of my user units and a system unit.

Specifically, i have a unit that runs my getmail script and i want it to run when
network-online.target has been activated.

Thus i have,

WantedBy=network-online.target

in it.

I installed it with

systemctl --user enable getmail.service

However, when i activate network-online.target, my getmail unit is not activated.

When i installed the unit as above, it creates the network-online.target.wants directory
where my user units are.

Anyways, this all says to me that network-online.target does not know about my unit.

How do i do this then if i want access to the 'system level' network-online.target?
Do i have to place it in /etc/systemd/system instead?
Then what the heck is the point of having these user sessions in the first place!

Thank you.

Last edited by captaincurrie (2014-08-19 13:44:53)

Offline

#2 2014-08-19 13:44:36

captaincurrie
Member
From: /dev/random
Registered: 2013-11-01
Posts: 82

Re: [Solved] systemd - can user units depend on system units

The answer is yes.

When running in user mode, the load path, by default, does not include system unit paths.

You can add units not in the load path with,

systemctl link <unit_name>

Offline

#3 2015-07-18 22:39:43

levitsky
Member
Registered: 2014-12-15
Posts: 1

Re: [Solved] systemd - can user units depend on system units

Will this work if my user service has a Wants= dependency on a system target?
I am trying to use

Wants=network-online.target
After=network-online.target

but it doesn't seem to work for me.

Offline

#4 2015-07-19 22:27:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 28,115
Website

Re: [Solved] systemd - can user units depend on system units


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB