#endif
run_now = bit_is_set(hour, run->hour) &&
- (bit_is_set(mday, run->mday) || bit_is_set(wday, run->wday)) &&
+ bit_is_set(mday, run->mday) &&
+ bit_is_set(wday, run->wday) &&
bit_is_set(month, run->month) &&
bit_is_set(wom, run->wom) &&
bit_is_set(woy, run->woy);
run_nh = bit_is_set(nh_hour, run->hour) &&
- (bit_is_set(nh_mday, run->mday) || bit_is_set(nh_wday, run->wday)) &&
+ bit_is_set(nh_mday, run->mday) &&
+ bit_is_set(nh_wday, run->wday) &&
bit_is_set(nh_month, run->month) &&
bit_is_set(nh_wom, run->wom) &&
bit_is_set(nh_woy, run->woy);
time_t now, tomorrow;
SCHED *sched;
struct tm tm;
- int mday, wday, month, wom, tmday, twday, tmonth, twom, i, hour;
+ int mday, wday, month, wom, tmday, twday, tmonth, twom, i;
int woy, twoy;
int tod, tom;
/*
* Find runs in next 24 hours
*/
- tod = (bit_is_set(mday, run->mday) || bit_is_set(wday, run->wday)) &&
- bit_is_set(month, run->month) && bit_is_set(wom, run->wom) &&
- bit_is_set(woy, run->woy);
-
- tom = (bit_is_set(tmday, run->mday) || bit_is_set(twday, run->wday)) &&
- bit_is_set(tmonth, run->month) && bit_is_set(twom, run->wom) &&
- bit_is_set(twoy, run->woy);
-
-// Dmsg2(200, "tod=%d tom=%d\n", tod, tom);
-// Dmsg2(200, "wom=%d twom=%d\n", wom, twom);
-// Dmsg1(200, "bit_set_wom=%d\n", bit_is_set(wom, run->wom));
+ tod = bit_is_set(mday, run->mday) && bit_is_set(wday, run->wday) &&
+ bit_is_set(month, run->month) && bit_is_set(wom, run->wom) &&
+ bit_is_set(woy, run->woy);
+
+ tom = bit_is_set(tmday, run->mday) && bit_is_set(twday, run->wday) &&
+ bit_is_set(tmonth, run->month) && bit_is_set(twom, run->wom) &&
+ bit_is_set(twoy, run->woy);
+
+#ifdef xxx
+ Dmsg2(000, "tod=%d tom=%d\n", tod, tom);
+ Dmsg1(000, "bit_set_mday=%d\n", bit_is_set(mday, run->mday));
+ Dmsg1(000, "bit_set_wday=%d\n", bit_is_set(wday, run->wday));
+ Dmsg1(000, "bit_set_month=%d\n", bit_is_set(month, run->month));
+ Dmsg1(000, "bit_set_wom=%d\n", bit_is_set(wom, run->wom));
+ Dmsg1(000, "bit_set_woy=%d\n", bit_is_set(woy, run->woy));
+#endif xxx
if (tod) { /* Jobs scheduled today (next 24 hours) */
+#ifdef xxx
+ char buf[300], num[10];
+ bsnprintf(buf, sizeof(buf), "tm.hour=%d hour=", tm.tm_hour);
+ for (i=0; i<24; i++) {
+ if (bit_is_set(i, run->hour)) {
+ bsnprintf(num, sizeof(num), "%d ", i);
+ bstrncat(buf, num, sizeof(buf));
+ }
+ }
+ bstrncat(buf, "\n", sizeof(buf));
+ Dmsg1(000, "%s", buf);
+#endif
/* find time (time_t) job is to be run */
localtime_r(&now, &tm);
- hour = 0;
for (i=tm.tm_hour; i < 24; i++) {
if (bit_is_set(i, run->hour)) {
tm.tm_hour = i;
tm.tm_min = run->minute;
tm.tm_sec = 0;
runtime = mktime(&tm);
+ Dmsg2(200, "now=%d runtime=%d\n", now, runtime);
if (runtime > now) {
- Dmsg2(100, "Found it level=%d %c\n", run->level, run->level);
+ Dmsg2(200, "Found it level=%d %c\n", run->level, run->level);
return run; /* found it, return run resource */
}
}
// Dmsg2(200, "runtime=%d now=%d\n", runtime, now);
if (tom) { /* look at jobs scheduled tomorrow */
localtime_r(&tomorrow, &tm);
- hour = 0;
for (i=0; i < 24; i++) {
if (bit_is_set(i, run->hour)) {
- hour = i;
- break;
+ tm.tm_hour = i;
+ tm.tm_min = run->minute;
+ tm.tm_sec = 0;
+ runtime = mktime(&tm);
+ Dmsg2(200, "now=%d runtime=%d\n", now, runtime);
+ if (runtime < tomorrow) {
+ Dmsg2(200, "Found it level=%d %c\n", run->level, run->level);
+ return run; /* found it, return run resource */
+ }
}
}
- tm.tm_hour = hour;
- tm.tm_min = run->minute;
- tm.tm_sec = 0;
- runtime = mktime(&tm);
-// Dmsg2(200, "truntime=%d now=%d\n", runtime, now);
- if (runtime < tomorrow) {
- return run; /* found it, return run resource */
- }
}
} /* end for loop over runs */
/* Nothing found */
POOLMEM *dest;
int dest_len;
- Dmsg2(200, "store_msgs pass=%d code=%d\n", pass, item->code);
+ Dmsg2(300, "store_msgs pass=%d code=%d\n", pass, item->code);
if (pass == 1) {
switch (item->code) {
case MD_STDOUT:
}
break;
}
- Dmsg1(200, "mail_cmd=%s\n", NPRT(cmd));
+ Dmsg1(300, "mail_cmd=%s\n", NPRT(cmd));
scan_types(lc, (MSGS *)(item->value), item->code, dest, cmd);
free_pool_memory(dest);
- Dmsg0(200, "done with dest codes\n");
+ Dmsg0(300, "done with dest codes\n");
break;
case MD_FILE: /* file */
case MD_APPEND: /* append */
pm_strcpy(&dest, lc->str);
dest_len = lc->str_len;
token = lex_get_token(lc, T_ALL);
- Dmsg1(200, "store_msgs dest=%s:\n", NPRT(dest));
+ Dmsg1(300, "store_msgs dest=%s:\n", NPRT(dest));
if (token != T_EQUALS) {
scan_err1(lc, _("expected an =, got: %s"), lc->str);
}
scan_types(lc, (MSGS *)(item->value), item->code, dest, NULL);
free_pool_memory(dest);
- Dmsg0(200, "done with dest codes\n");
+ Dmsg0(300, "done with dest codes\n");
break;
default:
}
scan_to_eol(lc);
set_bit(index, res_all.hdr.item_present);
- Dmsg0(200, "Done store_msgs\n");
+ Dmsg0(300, "Done store_msgs\n");
}
/*
if (lc->ch != ',') {
break;
}
- Dmsg0(200, "call lex_get_token() to eat comma\n");
+ Dmsg0(300, "call lex_get_token() to eat comma\n");
lex_get_token(lc, T_ALL); /* eat comma */
}
- Dmsg0(200, "Done scan_types()\n");
+ Dmsg0(300, "Done scan_types()\n");
}
lex_get_token(lc, T_NAME);
if (pass == 2) {
- Dmsg2(200, "Code=%d name=%s\n", item->code, lc->str);
+ Dmsg2(300, "Code=%d name=%s\n", item->code, lc->str);
res = GetResWithName(item->code, lc->str);
if (res == NULL) {
scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"),
#ifdef xxx
for (int i=0; item->name;; i++, item++) {
if (bit_is_set(i, res->item_present)) {
- Dmsg2(000, "Item %d is present in %s\n", i, res->name);
+ Dmsg2(300, "Item %d is present in %s\n", i, res->name);
} else {
- Dmsg2(000, "Item %d is not present in %s\n", i, res->name);
+ Dmsg2(300, "Item %d is not present in %s\n", i, res->name);
}
}
/* ***FIXME **** add code */
/* Make two passes. The first builds the name symbol table,
* and the second picks up the items.
*/
- Dmsg0(200, "Enter parse_config()\n");
+ Dmsg0(300, "Enter parse_config()\n");
for (pass=1; pass <= 2; pass++) {
- Dmsg1(200, "parse_config pass %d\n", pass);
+ Dmsg1(300, "parse_config pass %d\n", pass);
lc = lex_open_file(lc, cf, NULL);
while ((token=lex_get_token(lc, T_ALL)) != T_EOF) {
- Dmsg1(150, "parse got token=%s\n", lex_tok_to_str(token));
+ Dmsg1(300, "parse got token=%s\n", lex_tok_to_str(token));
switch (state) {
case p_none:
if (token == T_EOL) {
* scan for = after the keyword */
if (!(items[i].flags & ITEM_NO_EQUALS)) {
token = lex_get_token(lc, T_ALL);
- Dmsg1 (150, "in T_IDENT got token=%s\n", lex_tok_to_str(token));
+ Dmsg1 (300, "in T_IDENT got token=%s\n", lex_tok_to_str(token));
if (token != T_EQUALS) {
scan_err1(lc, _("expected an equals, got: %s"), lc->str);
/* NOT REACHED */
}
}
- Dmsg1(150, "calling handler for %s\n", items[i].name);
+ Dmsg1(300, "calling handler for %s\n", items[i].name);
/* Call item handler */
items[i].handler(lc, &items[i], i, pass);
i = -1;
}
}
if (i >= 0) {
- Dmsg2(150, "level=%d id=%s\n", level, lc->str);
- Dmsg1(150, "Keyword = %s\n", lc->str);
+ Dmsg2(300, "level=%d id=%s\n", level, lc->str);
+ Dmsg1(300, "Keyword = %s\n", lc->str);
scan_err1(lc, _("Keyword \"%s\" not permitted in this resource.\n"
"Perhaps you left the trailing brace off of the previous resource."), lc->str);
/* NOT REACHED */
case T_EOB:
level--;
state = p_none;
- Dmsg0(150, "T_EOB => define new resource\n");
+ Dmsg0(300, "T_EOB => define new resource\n");
save_resource(res_type, items, pass); /* save resource */
break;
}
lc = lex_close_file(lc);
}
- Dmsg0(200, "Leave parse_config()\n");
+ Dmsg0(300, "Leave parse_config()\n");
}
/*********************************************************************
#undef VERSION
#define VERSION "1.33.4"
#define VSTRING "1"
-#define BDATE "12 Mar 2004"
-#define LSMDATE "12Mar04"
+#define BDATE "13 Mar 2004"
+#define LSMDATE "13Mar04"
/* Debug flags */
#undef DEBUG