systemd.timer: never use * seconds

George Shuklin
OpsOps
Published in
Apr 1, 2022

I’ve just committed the silliest blunder possible. I wrote a timer with * in a seconds field for OnCalendar.

This is what I wrote:

OnCalendar=*-*-* *:0,15,30,45:*

What I’ve meant? I wanted it to run every 15 minutes.

What thing I wrote means?

Uh… Every 15 minutes run job every second for that minute. Buhhaaaah. 60*4 = 240 jobs per hour. Given that job is run for about 5 minutes, that’s infinite job queue.

Why I hadn’t noticed it right away? Because after daemon-reload it’d shown me in “LEFT” column a decent “3min 8s left” or something like that. Which looked exactly like a job with 15-minutes interval.

How proper schedule looks like?

OnCalendar=*-*-* *:0,15,30,45:00

Yes. Every 15 minutes when seconds are zero. Not ‘any second’.

Huh. I’m happy I caught it in pre-production setup.

--

--

George Shuklin
OpsOps

I work at Servers.com, most of my stories are about Ansible, Ceph, Python, Openstack and Linux. My hobby is Rust.