3

I want a script to run minutely, but stop executing it during the nighttime.

I tried

OnCalendar=*-*-* 05..00:*:00

but that lead to

Failed to parse calendar specification, ignoring: *-*-* 05..00:*:00
Timer unit lacks value setting. Refusing

Whats wrong here?

  • If this fix didn't make it into your version of systemd, try the workaround of specifying each allowable hour separated by a comma. – Mark Plotnick Apr 18 '18 at 16:23
3

You're using an invalid time range. When using BEGIN..END, END must be later than BEGIN. Obviously, 00 is earlier than 05 so 05..00 errors out. You need

OnCalendar=*-*-* 05..23:*:00

This will run your script every minute from 05:00 until 23:59. I assume that was your intent. If instead you wanted to run from 05:00 until 0:59 you would use

OnCalendar=*-*-* 00,05..23:*:00
-1

Taken from the systemd.time man page:

*-*-* 03-05:*:00

The above example would cause the systemd managed script to run every minute between the hours of 03 and 05

  • This does not seem to solve the problem, I still get the output Failed to parse calendar specification, ignoring: *-*-* 05-00:*:00 – Unkn0wn Apr 18 '18 at 14:31
  • @don_crissti systemd --version systemd 232 – Unkn0wn Apr 18 '18 at 14:43
  • 1
    As don_crissti points out, your example is not a direct quote from the man page, and is invalid syntax. This answer should be removed. – Johann Aug 28 '18 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.