extern int range_start;
extern int range_stop;
+/* preferred hour for jobs */
+extern int preferred_hour;
+
/* Function prototypes */
/* main.c */
jobtime = start_sec + jr->delay * 60;
t = localtime(&jobtime);
+ if (!now && preferred_hour != -1 && t->tm_hour != preferred_hour) {
+ Debug(("The job's %s preferred hour %d was missed, skipping the job.", jr->ident, preferred_hour));
+ xclose (jr->timestamp_fd);
+ return 0;
+ }
+
if (!now && range_start != -1 && range_stop != -1 &&
(t->tm_hour < range_start || t->tm_hour >= range_stop))
{
int running_jobs, running_mailers; /* , number of */
int range_start = -1;
int range_stop = -1;
+int preferred_hour = -1;
static void
print_version()
char *command;
char *from;
char *to;
+ char *pref_hour;
/* an empty line? */
r = match_rx("^[ \t]*($|#)", line, 0);
}
else goto reg_invalid;
}
+ if (strncmp(env_var, "PREFERRED_HOUR", 14) == 0) {
+ r = match_rx("^([[:digit:]]+)$", value, 1, &pref_hour);
+ if ((r != -1) || (pref_hour != NULL)) {
+ preferred_hour = atoi(pref_hour);
+ if ((preferred_hour < 0) || (preferred_hour > 24)) {
+ preferred_hour = -1;
+ goto reg_invalid;
+ }
+ }
+ }
register_env(env_var, value);
return;
}