Web lists-archives.com

Re: systemd+anacron breaks cron jobs

Am 05.12.18 um 10:04 schrieb Kamil Jońca:
> Michael Biebl <biebl@xxxxxxxxxx> writes:

>>>  which in turn, can break ALL your "user" units)
>> I'd be interested to know, what exactly you have in mind here. I'm not
>> aware of such a breakage.
> For example: I have (--user)
> kj-keepassx.service - my own service with keepasx
> xscreensaver-monitor.service - my own service which to monitor screensaver
> These services should NOT be run withoud graphical login.

If those services are tied to a X login session, they should not be
started via systemd --user (at least, not yet)

Let me go into a bit more detail.

There is only ever *one* systemd --user instance per user. It is
typically started, the first time you log in and stopped, once there is
no more active login session for a particular user.

If you have multiple active login sessions (say X, and one console login
on tty2), you still have only one systemd --user instance.
If you now logout from X, the systemd --user instance is not stopped,
only if you also logout from tty2.

I hope, you can now see that your kj-keepassx.service is not going to work.

What you really want, is to start that service as part of a X login
session. Those are traditionally handled via
/etc/xdg/autostart and ~/.config/autostart

There are attempts to provide such a XDG autostart equivalent facility
in systemd, by providing a target, which becomes active once a X session
starts and becomes inactive, once the X session ends.
User units which are supposed to be tied to X sessions can then bind to
that target.

See https://blogs.gnome.org/laney/2018/06/26/starting-sessions-with-systemd/
if you want to read a bit more about it.

For the time being, starting a service via a systemd user service which
is bound to the life-time of an X session, is not really supported and I
would recommend you use ~/.config/autostart for it instead.


Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature