crontab entry misconfigured by GUI? (Maybe Bug 897?)

Status
Not open for further replies.

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
System Information
Hostname ratchet.xxxxxxx.xxx
Build FreeNAS-9.3-STABLE-201503200528
Platform Intel(R) Pentium(R) CPU J2900 @ 2.41GHz
Memory 16060MB
System Time Wed Mar 25 07:04:30 PDT 2015
Uptime 7:04AM up 4 days, 17:40, 1 user
Load Average 0.01, 0.04, 0.01


OK, I looked around both here on the forums as well on the support site and I think I found a bug related to what I am seeing but the bug (897) was marked fixed 3 years ago. However I am seeing the exact same symptoms and outputs as the OP of that bug. Maybe I am just missing something...


I have a script that runs a couple of tasks and emails me a report. The script in question I want to run every Sunday at 1230 hours. I created (via the GUI) a cron entry for every day of the month, every month of the year and only Sunday as the day of the week. With those cron instruction, I would have expected something like this:

30 00 * * 7 root /root/scripts/ratchet_smart_report.sh > /dev/null

but instead I see this:

30 00 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 * 7 root /root/scripts/ratchet_smart_report.sh > /dev/null


And the script which is supposed to run every Sunday at 1230 hours is running every single day at 1230 hours. Removing the actual days of the month from the GUI gives me an error saying that it is a required entry.

Physically changing the /etc/crontab via vi simple results in the GUI rewriting it anytime I make another change in the GUI.

Hopefully I am just missing something here and someone can point me in the right direction.



screen 2015-03-25 at 7.08.27 AM.jpg
 
D

dlavigne

Guest
I created (via the GUI) a cron entry for every day of the month, every month of the year and only Sunday as the day of the week.

I think it's seeing the "every day of the month". What happens if you remove that part from the GUI entry?
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
I thought that as well so I tried to remove the days. It won't let me. It gives me an error saying that it is a required field.

screen 2015-03-25 at 12.43.40 PM.jpg
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
I suspect it will not run as it would have to match both the day and the date - ie Sunday the 4th. At least this is how cron works on all of my linux boxes.

I will give it a try however and see, it is a good suggestion!
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
As suspected, it did not run at all when I selected just a single day plus the day of the week.
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
I went in and manually changed the crontab and put an * in days of the month field and I will see if it runs correctly.

I will also try just putting down the 1st of the month (as opposed to selecting todays date) and see if that helps.
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
OK, it appears that selecting the first of the month as suggested by dlavigne does fix the problem, at least in a quick test. I have three freenas boxes and the behaviour is the same on all three which leads me to think that it is something in how the FreeNas GUI is writing the cron which is exactly like the description in Bug 897:


Although I select only one specific day in the "Each selected day of month" tab in the "Edit" pop-up window of cron jobs, the job is executed every day.

The source of the problem can be identified by investigating a sample crontab entry generated by the GUI:

*/1 */1 05 1,2,3,4,5,6,7,8,9,10,11,12 1,2,3,4,5,6,7 root PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin touch /root/xxx >/dev/null 2>&1

For this case, the 1,2,3,4,5,6,7 specification for the "Day of week" is incorrect, as the man page of crontab says:

Note: The day of a command's execution can be specified by two fields --
day of month, and day of week. If both fields are restricted (i.e., are
not *), the command will be run when either field matches the current
time. For example, @@30 4 1,15 * 5_ would cause a command to be run at
4:30 am on the 1st and 15th of each month, plus every Friday.

Suggestion: If all checkboxes are selected in the "Day of week" part of the GUI, write an * (asterix) instead of "1,2,3,4,5,6,7" in the crontab file.
 

HeloJunkie

Patron
Joined
Oct 15, 2014
Messages
300
Well, it looks like I spoke too soon. The crons ran once and then failed to run again. Looks like this is still an issue.
 

Sloeg

Cadet
Joined
Dec 4, 2015
Messages
1
Hi,

seems the Problem / Bug is still existing.

it´s not possible to shedule an job running just a specific Day per Week.

When I select just first Day of month (Tip in ths Post), the Job runs only this day (1time per month).

unselecting all Days (31) and just select 1 Day per Week (eg Sa) gives out error "This field is required." -> you have to select at least 1 Day

any Ideas?
 
Status
Not open for further replies.
Top