SOLVED PowerManagement Cron DayOfWeek
Server: 14.04.1-Ubuntu x64
Fog: Running Version 1.4.4 | SVN Revision: 6077
i have some trouble with the PowerManagement scheduled power tasks.
If i use the d-o-w option e.g. 1-5 for Mon-Fri like 15 8 * * 1-5 for a WOL-task it ignores the dow 1-5 and keeps starting on weekends.
If i use only one day linke 20 11 * * 2 it works fine and shows right in the fogscheduler.log.
If i use sth. like 20 11 * * 2-5 it shows next task
Task run time: Mon, 23 Oct 2017 11:41:18 +0200
But as the 2-5 says it should be 11:20 on every day-of-week from Tuesday through Friday.
I assume it is sth. with the syntax oder with the code. Could not find sth. similar in the forum or the wiki.
Some ideas here? My server-date is correct
And if you want the latest file that appears to be working FAR more accurately/appropriately:
wget -O /var/www/fog/lib/fog/fogcron.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working/packages/web/lib/fog/fogcron.class.php
Tom Elliott last edited by Tom Elliott
Found and fixed.
If you need a quick fix, edit /var/www/fog/lib/fog/fogcron.class.php
return (bool)($num = $low);
It should show up on line 45 (or very close to it).
Make it read as:
return (bool)($num == $low);
It should be noted this will be fixed in RC 11.
EDIT 1: More accurately, we should actually replace with:
return (bool)($num >= $low) && ($num <= $high);
I want to bump this, but I’m afraid I don’t have a good mechanism to test this right now. I’m working on a php script so I can try to see what’s going on though.
@Tom-Elliott Just bumping this so we don’t loose track of it.
@tom-elliott okay, so i tested it with 50-55 * * * * to check if the “-” is a problem.
The fogscheduler.log found a wake on lan task that should run.
[10-25-17 12:49:52 pm] * Task run time: Wed, 25 Oct 2017 12:49:52 +0200 [10-25-17 12:49:52 pm] * Found a wake on lan task that should run. [10-25-17 12:49:52 pm] | Task sent to COMPUTER
But keeps on going …
[10-25-17 12:58:52 pm] * Task run time: Wed, 25 Oct 2017 12:58:52 +0200 [...] [10-25-17 1:00:52 pm] * Task run time: Wed, 25 Oct 2017 13:00:52 +0200 [10-25-17 1:00:52 pm] * Found a wake on lan task that should run. [...]
This would confirm that sth. with the “-” is translated to “*” because than it would be * * * * which should mean “At every minute.” That would also explain why it started at minute 49 …
So i think there is a global problem.
@fritzbox360 I’m not asking specifically about “DOW” in this case. The , / and - characters all use the same functions regardless of the element in use. Min, Hour, DOM, Month, or DOW. I’m just trying to confirm if the problem with -'s occurs on any field.
If i use the “-” for a range of values e.g. 1-5 there is a problem. If i seperate the values like 1,2,3,4,5 it seems correct.
I will do some more testing…
@Tom-Elliott - thanks for your reply!
Yes, all other days work but only if i use it seperated. If i use it combined like 1-3 it ignores this value and sets it like an * because it takes the whole week.
Do all other stepped patterns work properly then? I ask because I don’t have a good means to test currently.
The stepped patterns are all handled by the same method, so I would suspect the same issue occurs on all stepped patterns correct?
6 = Saturday
5 = Friday
4 = Thursday
3 = Wednesday
2 = Tuesday
1 = Monday
0 or 7 = Sunday