This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scheduled Script - Feb 31st
#1
Hi,

Sometimes I create scripts that should never be run automatically. This is usually for testing or convenience. I usually make these as scheduled scripts, so I can press "Run script" to execute the code.

As a scheduled script normally should be run automatically, you still need to fill in the cron format as to when the script should execute. Usually I just fill inn "* * 31 2 1", so that it should never execute automatically. This is February 31st, which will never occur.

I did however notice that the script is being executed automatically today. Is this expected behavior or is this a bug in your cronjob handling?

See the attached images. For now, I'll just have to disable the scripts, which is fine.

Edit: This bug occurred in another site I have such a script enabled. That was a lightshow script for floodlights at a football stadium. Every Monday the customer complained that the lights turned on a midnight and stayed on. I didn't connect this until now. So it seems the bug is that the script runs every Monday of February.

It might be in the spec of cronjobs, that when it runs into an invalid date, it runs on every occasion instead.

Attached Files Thumbnail(s)
       
Reply
#2
This is by design: if either the month or day of month is specified as an element or list, and the day of week is also specified as an element or list, then any day matching either the month and day of month, or the day of week, shall be matched
Reply
#3
(21.02.2022, 16:36)admin Wrote: This is by design: if either the month or day of month is specified as an element or list, and the day of week is also specified as an element or list, then any day matching either the month and day of month, or the day of week, shall be matched

Ah, I see now. So, to avoid this I'll have to specify every weekday to avoid it being run automatically. Images fromĀ https://crontab.guru

Attached Files Thumbnail(s)
       
Reply


Forum Jump: