Maybe I am not understanding the cron scheduler properly but this is what I am seeing in the code :
public boolean isCronScheduleType() {
return "true".equalsIgnoreCase(getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE));
}
then to get the schedule itself :
public ScannerSchedule getCronSchedule() {
String cronSched = getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE);
if(cronSchedule==null&&cronSched!=null) {
try {
cronSchedule = new ScannerSchedule(cronSched);
} catch (Exception e) {
getLog().logError(e);
}
}
how can the value be "true" and the scheduled time at simultaneously ? My scanner is not running at the supposed cron time. Can anybody post any example mine :
sqlscanner.cronSchedule=35 13 1,15 5
no exceptions are thrown, instead the scanner runs periodically. Based on reading the code, the cronSchedule should take priority, but because the value I specified is not equal to true, it never runs
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are right. Earlier, there was another boolean property which was used for specifying if scanner worker should be run using cron-like settings. However, this was removed and now it should be enough if cronSchedule parameter is specified. Obiviously, there is error in isCronScheduleType method - it should return be somethig like:
public boolean isCronScheduleType() {
return (getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE)!=null);
}
I am the one responsible for this peace of code, but it seems that nobody used cron feature for a while. Please try to change this method, and recompile. I guess it should work!
Check in the javadocs of ScannerSchedule.java for cron syntax. Basicly, you should have five parameters separated by space. Your example only have four (1,15 is one parameter). As I can remember, currently you can only use numbers for months and days of week and not names like JAN, FEB etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Doesn't this mean that it will only run if the day of month, month and day of week all matches up ? Isn't the intended usage: if (day of month and month ) or ( day of week matches up ) then run ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe I am not understanding the cron scheduler properly but this is what I am seeing in the code :
public boolean isCronScheduleType() {
return "true".equalsIgnoreCase(getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE));
}
then to get the schedule itself :
public ScannerSchedule getCronSchedule() {
String cronSched = getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE);
if(cronSchedule==null&&cronSched!=null) {
try {
cronSchedule = new ScannerSchedule(cronSched);
} catch (Exception e) {
getLog().logError(e);
}
}
how can the value be "true" and the scheduled time at simultaneously ? My scanner is not running at the supposed cron time. Can anybody post any example mine :
sqlscanner.cronSchedule=35 13 1,15 5
no exceptions are thrown, instead the scanner runs periodically. Based on reading the code, the cronSchedule should take priority, but because the value I specified is not equal to true, it never runs
You are right. Earlier, there was another boolean property which was used for specifying if scanner worker should be run using cron-like settings. However, this was removed and now it should be enough if cronSchedule parameter is specified. Obiviously, there is error in isCronScheduleType method - it should return be somethig like:
public boolean isCronScheduleType() {
return (getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE)!=null);
}
I am the one responsible for this peace of code, but it seems that nobody used cron feature for a while. Please try to change this method, and recompile. I guess it should work!
Check in the javadocs of ScannerSchedule.java for cron syntax. Basicly, you should have five parameters separated by space. Your example only have four (1,15 is one parameter). As I can remember, currently you can only use numbers for months and days of week and not names like JAN, FEB etc.
I have submitted this problem as new issue #953888. Have you tested with change I suggested? Does it work correctly?
Sorry haven't had time to test it yet, having another emergency in the work place :). Will let you know once I tested it.
OK, the cronSchedule is being honored now, but I found the following snippet and I am not sure how to proceed:
boolean timeToRun = minutes[calendar.get(Calendar.MINUTE)] &&
hours[calendar.get(Calendar.HOUR_OF_DAY)] &&
days[calendar.get(Calendar.DAY_OF_MONTH) - 1] &&
months[calendar.get(Calendar.MONTH)] &&
daysOfWeek[calendar.get(Calendar.DAY_OF_WEEK) - 1];
Doesn't this mean that it will only run if the day of month, month and day of week all matches up ? Isn't the intended usage: if (day of month and month ) or ( day of week matches up ) then run ?
what happens if you change the code to as you suggest?