Discussion:
Does user timer start at boot?
(too old to reply)
Kamil Jońca
2018-10-02 14:25:36 UTC
Permalink
I do not know if I not overlooked something.

But my question is:
Does "--user" timer start at boot like user cron entries?
KJ
--
http://wolnelektury.pl/wesprzyj/teraz/
It is better to never have tried anything than to have tried something and
failed.
-- motto of jerks, weenies and losers everywhere
Lennart Poettering
2018-10-02 15:00:23 UTC
Permalink
Post by Kamil Jońca
I do not know if I not overlooked something.
Does "--user" timer start at boot like user cron entries?
Not normally no. That's because the systemd --user instance (which
runs user services, i.e. user@<foobar>.service) is not run at boot for
regular users.

That said you can do "loginctl set-linger <someusers>". If you do,
then the user's systemd --user instance gets started at boot, and is
shutdown only when the system goes down. In that case the timers are
runnable also before the user logs in, starting with the system boot.

Lennart
--
Lennart Poettering, Red Hat
Kamil Jońca
2018-10-02 15:14:45 UTC
Permalink
Post by Lennart Poettering
Post by Kamil Jońca
I do not know if I not overlooked something.
Does "--user" timer start at boot like user cron entries?
Not normally no. That's because the systemd --user instance (which
regular users.
That said you can do "loginctl set-linger <someusers>". If you do,
then the user's systemd --user instance gets started at boot, and is
shutdown only when the system goes down. In that case the timers are
runnable also before the user logs in, starting with the system boot.
So I cannot run ONLY user timers?
(IE i have some services which I want only on user login, but I want to
use timers at boot?)
KJ
--
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html
philosophy:
Unintelligible answers to insoluble problems.
Lennart Poettering
2018-10-02 15:22:51 UTC
Permalink
Post by Kamil Jońca
So I cannot run ONLY user timers?
(IE i have some services which I want only on user login, but I want to
use timers at boot?)
Well, depends how you login happens. I think it would be wise for
graphical DEs to enqueue some target as soon as a graphical login
actually happens, i.e. gnome-session should probably start
"gnome.target" or so, when an actual login happens, and then you could
hook into that.

But no, there's no generic framework for that.

Lennart
--
Lennart Poettering, Red Hat
Kamil Jońca
2018-10-02 15:40:24 UTC
Permalink
Post by Lennart Poettering
Post by Kamil Jońca
So I cannot run ONLY user timers?
(IE i have some services which I want only on user login, but I want to
use timers at boot?)
Well, depends how you login happens. I think it would be wise for
graphical DEs to enqueue some target as soon as a graphical login
actually happens, i.e. gnome-session should probably start
"gnome.target" or so, when an actual login happens, and then you could
hook into that.
I think about little different situation.

I have some user timers.
I boot machine and I want these timers started, without user login or so.
A ... day after I log in to machine
And I want rest of user services started.
As I understand it is impossible with systemd?
KJ
--
http://wolnelektury.pl/wesprzyj/teraz/
Stupidity, like virtue, is its own reward.
Lennart Poettering
2018-10-02 15:57:49 UTC
Permalink
Post by Kamil Jońca
Post by Lennart Poettering
Post by Kamil Jońca
So I cannot run ONLY user timers?
(IE i have some services which I want only on user login, but I want to
use timers at boot?)
Well, depends how you login happens. I think it would be wise for
graphical DEs to enqueue some target as soon as a graphical login
actually happens, i.e. gnome-session should probably start
"gnome.target" or so, when an actual login happens, and then you could
hook into that.
I think about little different situation.
I have some user timers.
I boot machine and I want these timers started, without user login or so.
A ... day after I log in to machine
And I want rest of user services started.
As I understand it is impossible with systemd?
Well, depends on how precisely you "log in". If you'd use a DE that
pulls in a target on each new session then you'd get what you are
looking for (as suggested above). But if you don't then no, there's no
generic hook defined that allows you to start something based on
whether there is a session or not that'd work for all kinds of
sessions.

If you are interested in text sessions, then bash (or whatever you use
as shell) is the sesion manager, and that doesn't invoke such a target
either. That said, you could add "systemctl --user --no-block start
tty-login.target" or so to your .profile and then hook into that
target.

But no, there is no generic solution for this. Sorry.

Lennart
--
Lennart Poettering, Red Hat
Continue reading on narkive:
Loading...