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

Re: user unit file



On Vi, 05 mar 21, 12:53:24, Jim Popovitch wrote:
> 
> Right now I can't get this to work:
> 
> ~$ systemctl --user enable Test.service
> Failed to connect to bus: No such file or directory

To save you some head banging after you fix this...

> ~$ cat ~/.config/systemd/user/Test.service
> [Unit]
> Description = Test Service
> After = network.target
> 
> [Service]
> WorkingDirectory=/home/bob/Test/
> ExecStart = bash Test.sh
> TimeoutSec=15
> 
> [Install]
> WantedBy=multi-user.target

... user units and system units are completely isolated from each other, 
so your After= and WantedBy= won't have the expected effect.


For WantedBy= you probably want (no pun intended) default.target 
instead.


This is a hack I'm using to order a user unite after a system unit is 
started:

	ExecStartPre=/usr/bin/sh -c 'until systemctl --quiet is-active network-online.target ; do sleep 1 ; done'


Note: you should read on network-online.target in systemd.special(7) if 
you intend to follow my example.

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

Attachment: signature.asc
Description: PGP signature


Reply to: