error("could not get time and date of saving");
goto err;
}
+ else {
+ debug("file saved at %lu.", t_save);
+ }
if (cf->cf_env_list == NULL)
cf->cf_env_list = env_list_init();
}
}
else { /* is_td(cl->cl_option) */
+ if (cl->cl_timefreq < 10) {
+ error("Invalid timefreq %ld for job '%s': setting to 1 day",
+ cl->cl_timefreq, cl->cl_shell);
+ cl->cl_timefreq = 3600 * 24;
+ }
+
/* standard @-lines */
if (is_system_startup && is_runatreboot(cl->cl_option)) {
cl->cl_nextexe = now;
if (cl->cl_nextexe != LONG_MAX) {
cl->cl_nextexe += slept;
if (cl->cl_nextexe < now || cl->cl_nextexe > TIME_T_MAX) {
- /* there was an integer overflow! */
+ /* either there was an integer overflow, or the slept time is incorrect
+ * (e.g. fcron didn't shut down cleanly and the fcrontab wasn't saved correctly) */
error
("Error while setting next exe time for job %s: cl_nextexe"
- " overflowed (case2). now=%lu, cl_timefreq=%lu, cl_nextexe=%lu.",
+ " overflowed (case2). now=%lu, cl_timefreq=%lu, cl_nextexe=%lu. "
+ "Did fcron shut down cleanly?",
cl->cl_shell, now, cl->cl_timefreq, cl->cl_nextexe);
error
- ("Setting cl_nextexe to TIME_T_MAX=%ld to prevent an infinite loop.",
- TIME_T_MAX);
- cl->cl_nextexe = TIME_T_MAX;
+ ("Setting cl_nextexe to now+cl_timefreq to prevent an infinite loop.");
+ cl->cl_nextexe = now + cl->cl_timefreq;
+ error("next execution will now be at %ld.", cl->cl_nextexe);
}
}
}
- if (cl->cl_timefreq < 10) {
- error("Invalid timefreq for %s: set to 1 day", cl->cl_shell);
- cl->cl_timefreq = 3600 * 24;
- }
-
insert_nextexe(cl);
}
if (date->tm_wday >= 7)
date->tm_wday -= 7;
- debug(" dow of %d-%d-%d : %d", (date->tm_mon + 1), date->tm_mday,
- (date->tm_year + 1900), date->tm_wday);
+ debug(" dow of %04d-%02d-%02d : %d", (date->tm_year + 1900),
+ (date->tm_mon + 1), date->tm_mday, date->tm_wday);
}
else {
line->cl_nextexe = basetime + line->cl_timefreq;
if (line->cl_nextexe <= basetime) {
- /* there was an integer overflow! */
+ /* either there was an integer overflow, or the slept time is incorrect
+ * (e.g. fcron didn't shut down cleanly and the fcrontab wasn't saved correctly) */
error("Error while setting next exe time for job %s: cl_nextexe"
- " overflowed (case3). basetime=%lu, cl_timefreq=%lu, cl_nextexe=%lu.",
+ " overflowed (case3). basetime=%lu, cl_timefreq=%lu, cl_nextexe=%lu. "
+ "Did fcron shut down cleanly?",
line->cl_shell, basetime, line->cl_timefreq,
line->cl_nextexe);
error
- ("Setting cl_nextexe to TIME_T_MAX to prevent an infinite loop.");
- line->cl_nextexe = TIME_T_MAX;
+ ("Setting cl_nextexe to now+cl_timefreq to prevent an infinite loop.");
+ line->cl_nextexe = now + line->cl_timefreq;
+ error("next execution will now be at %ld.", line->cl_nextexe);
}
}