[systemd-devel] Can service of timers.target having After=multi-user.target create a loop?

Amish anon.amish at gmail.com
Sun Jul 12 13:21:34 UTC 2020


Hello,

This is a question out of curiosity and not currently any problem.

I have a timer file like this:

[Unit]
Description=Foo
After=multi-user.target

[Timer]
OnCalendar=*:0/5
Persistent=false

[Install]
WantedBy=timers.target

And corresponding service file like this:

[Unit]
Description=Foo

[Service]
Type=oneshot
ExecStart=-/usr/bin/checkservices

/usr/bin/checkservices checks if some important services are running and 
sends alert if not.

Above timer is supposed to run every five minutes. But not while system 
is still booting.

If I do not put After=multi-user.target then timer gets triggered even 
before those services have begun (while booting) and sends false alarm.

With above settings, I do not face that issue.

But just out of curiosity I am eager to know if this or something 
similar can cause loop and hang system forever from booting?

Because AFAIK timers.target runs before multi-user.target. But here 
something inside timers.target waits for multi-user.target.

So how does systemd resolve this loop?

Thanks in advance

Amish



More information about the systemd-devel mailing list