mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Made cron work properly with 'wdays'
SVN revision: 717
This commit is contained in:
parent
86a7550e94
commit
72065dbaed
183
src/elogd.c
183
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.212 2004/01/27 11:22:56 midas
|
||||||
|
Made cron work properly with 'wdays'
|
||||||
|
|
||||||
Revision 1.211 2004/01/26 16:21:49 midas
|
Revision 1.211 2004/01/26 16:21:49 midas
|
||||||
Revised logging for synchronizing
|
Revised logging for synchronizing
|
||||||
|
|
||||||
@ -3940,10 +3943,10 @@ void logf(LOGBOOK * lbs, const char *format, ...)
|
|||||||
{
|
{
|
||||||
char file_name[2000];
|
char file_name[2000];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char str[10000], lb[256];
|
char str[10000];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
time_t now;
|
time_t now;
|
||||||
char buf[256];
|
char buf[1000];
|
||||||
|
|
||||||
if (lbs == NULL) {
|
if (lbs == NULL) {
|
||||||
if (!getcfg("global", "logfile", str))
|
if (!getcfg("global", "logfile", str))
|
||||||
@ -3968,19 +3971,21 @@ void logf(LOGBOOK * lbs, const char *format, ...)
|
|||||||
|
|
||||||
now = time(0);
|
now = time(0);
|
||||||
strftime(buf, sizeof(buf), "%d-%b-%Y %H:%M:%S", localtime(&now));
|
strftime(buf, sizeof(buf), "%d-%b-%Y %H:%M:%S", localtime(&now));
|
||||||
|
strcat(buf, " ");
|
||||||
|
|
||||||
if (lbs == NULL)
|
if (*getparam("unm") && rem_host[0])
|
||||||
lb[0] = 0;
|
sprintf(buf+strlen(buf), "[%s@%s] ", getparam("unm"), rem_host);
|
||||||
else
|
else if (rem_host[0])
|
||||||
strlcpy(lb, lbs->name, sizeof(lb));
|
sprintf(buf+strlen(buf), "[%s] ", rem_host);
|
||||||
|
|
||||||
if (*getparam("unm"))
|
if (lbs)
|
||||||
fprintf(f, "%s [%s@%s] %s: %s", buf, getparam("unm"), rem_host, lb, str);
|
sprintf(buf+strlen(buf), "{%s} ", lbs->name);
|
||||||
else
|
|
||||||
fprintf(f, "%s [%s] %s: %s", buf, rem_host, lb, str);
|
|
||||||
|
|
||||||
if (str[strlen(str) - 1] != '\n')
|
strlcat(buf, str, sizeof(buf));
|
||||||
fprintf(f, "\n");
|
if (buf[strlen(buf) - 1] != '\n')
|
||||||
|
strlcat(buf, "\n", sizeof(buf));
|
||||||
|
|
||||||
|
fprintf(f, buf);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
@ -8204,6 +8209,13 @@ int retrieve_remote_md5(LOGBOOK * lbs, char *host, MD5_INDEX ** md5_index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n == 0) {
|
||||||
|
if (strstr(text, "Login"))
|
||||||
|
sprintf(error_str, loc("No user name supplied to access remote logbook"));
|
||||||
|
else
|
||||||
|
sprintf(error_str, loc("Error accessing remote logbook"));
|
||||||
|
}
|
||||||
|
|
||||||
/* debugging only
|
/* debugging only
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
int j;
|
int j;
|
||||||
@ -8942,19 +8954,23 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
|
|
||||||
md5_remote = NULL;
|
md5_remote = NULL;
|
||||||
n_remote = retrieve_remote_md5(lbs, list[index], &md5_remote, error_str);
|
n_remote = retrieve_remote_md5(lbs, list[index], &md5_remote, error_str);
|
||||||
if (n_remote < 0) {
|
if (n_remote <= 0) {
|
||||||
|
|
||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, error_str);
|
logf(lbs, error_str);
|
||||||
else
|
else
|
||||||
rsprintf(error_str);
|
rsprintf("%s\n", error_str);
|
||||||
|
|
||||||
if (md5_remote)
|
if (md5_remote)
|
||||||
free(md5_remote);
|
free(md5_remote);
|
||||||
|
|
||||||
|
if (!bcron)
|
||||||
|
rsprintf("</pre>\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load local copy of remote MD5s from file */
|
/* load local copy of remote MD5s from file */
|
||||||
|
md5_cache = NULL;
|
||||||
n_cache = load_md5(lbs, list[index], &md5_cache);
|
n_cache = load_md5(lbs, list[index], &md5_cache);
|
||||||
|
|
||||||
/* if this is the first time (no cache exists yet), use remote list instead */
|
/* if this is the first time (no cache exists yet), use remote list instead */
|
||||||
@ -8972,7 +8988,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, "Error loading configuration file: %s", error_str);
|
logf(lbs, "Error loading configuration file: %s", error_str);
|
||||||
else
|
else
|
||||||
rsprintf("Error loading configuration file: %s", error_str);
|
rsprintf("Error loading configuration file: %s\n", error_str);
|
||||||
} else
|
} else
|
||||||
MD5_checksum(buffer, strlen(buffer), digest);
|
MD5_checksum(buffer, strlen(buffer), digest);
|
||||||
|
|
||||||
@ -8991,7 +9007,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (n_remote > 0) {
|
if (n_remote > 0) {
|
||||||
/* if message has been changed on this server, but not remotely, send it */
|
/* if config has been changed on this server, but not remotely, send it */
|
||||||
if (!equal_md5(md5_cache[0].md5_digest, digest)
|
if (!equal_md5(md5_cache[0].md5_digest, digest)
|
||||||
&& equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)) {
|
&& equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)) {
|
||||||
|
|
||||||
@ -8999,7 +9015,8 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
logf(lbs, "MIRROR send config");
|
logf(lbs, "MIRROR send config");
|
||||||
|
|
||||||
/* submit configuration section */
|
/* submit configuration section */
|
||||||
submit_config(lbs, list[index], buffer, error_str);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
submit_config(lbs, list[index], buffer, error_str);
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
@ -9014,14 +9031,15 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
md5_cache[0].message_id = -1;
|
md5_cache[0].message_id = -1;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if message has been changed remotely, but not on this server, receive it */
|
/* if config has been changed remotely, but not on this server, receive it */
|
||||||
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
||||||
&& equal_md5(md5_cache[0].md5_digest, digest)) {
|
&& equal_md5(md5_cache[0].md5_digest, digest)) {
|
||||||
|
|
||||||
if (_logging_level > 1)
|
if (_logging_level > 1)
|
||||||
logf(lbs, "MIRROR receive config");
|
logf(lbs, "MIRROR receive config");
|
||||||
|
|
||||||
receive_config(lbs, list[index], error_str);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
receive_config(lbs, list[index], error_str);
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
@ -9035,7 +9053,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
md5_cache[0].message_id = -1;
|
md5_cache[0].message_id = -1;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if message has been changed remotely and on this server, show conflict */
|
/* if config has been changed remotely and on this server, show conflict */
|
||||||
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
||||||
&& !equal_md5(md5_cache[0].md5_digest, digest)
|
&& !equal_md5(md5_cache[0].md5_digest, digest)
|
||||||
&& !equal_md5(md5_remote[0].md5_digest, digest)) {
|
&& !equal_md5(md5_remote[0].md5_digest, digest)) {
|
||||||
@ -9051,7 +9069,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* messages are identical */
|
/* configs are identical */
|
||||||
md5_cache[0].message_id = -1;
|
md5_cache[0].message_id = -1;
|
||||||
}
|
}
|
||||||
} else { /* n_remote == 0 */
|
} else { /* n_remote == 0 */
|
||||||
@ -9113,14 +9131,15 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
logf(lbs, "MIRROR send entry #%d", message_id);
|
logf(lbs, "MIRROR send entry #%d", message_id);
|
||||||
|
|
||||||
/* submit local message */
|
/* submit local message */
|
||||||
submit_message(lbs, list[index], message_id, error_str);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
submit_message(lbs, list[index], message_id, error_str);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
/* not that submit_message() may have changed attr_list !!! */
|
/* not that submit_message() may have changed attr_list !!! */
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, "Error sending local message: %s\n", error_str);
|
logf(lbs, "Error sending local message: %s", error_str);
|
||||||
else
|
else
|
||||||
rsprintf("Error sending local message: %s\n", error_str);
|
rsprintf("Error sending local message: %s\n", error_str);
|
||||||
} else if (!bcron)
|
} else if (!bcron)
|
||||||
@ -9138,12 +9157,13 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
if (_logging_level > 1)
|
if (_logging_level > 1)
|
||||||
logf(lbs, "MIRROR receive entry #%d", message_id);
|
logf(lbs, "MIRROR receive entry #%d", message_id);
|
||||||
|
|
||||||
receive_message(lbs, list[index], message_id, error_str, FALSE);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
receive_message(lbs, list[index], message_id, error_str, FALSE);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, "Error receiving message: %s\n", error_str);
|
logf(lbs, "Error receiving message: %s", error_str);
|
||||||
else
|
else
|
||||||
rsprintf("Error receiving message: %s\n", error_str);
|
rsprintf("Error receiving message: %s\n", error_str);
|
||||||
} else if (!bcron)
|
} else if (!bcron)
|
||||||
@ -9191,7 +9211,8 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
if (_logging_level > 1)
|
if (_logging_level > 1)
|
||||||
logf(lbs, "MIRROR delete local entry #%d", message_id);
|
logf(lbs, "MIRROR delete local entry #%d", message_id);
|
||||||
|
|
||||||
el_delete_message(lbs, message_id, TRUE, NULL, TRUE, TRUE);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
el_delete_message(lbs, message_id, TRUE, NULL, TRUE, TRUE);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (!bcron)
|
if (!bcron)
|
||||||
@ -9199,6 +9220,9 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
|
|
||||||
/* message got deleted from local message list, so redo current index */
|
/* message got deleted from local message list, so redo current index */
|
||||||
i_msg--;
|
i_msg--;
|
||||||
|
|
||||||
|
/* mark message non-conflicting */
|
||||||
|
md5_cache[i_cache].message_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if message does not exist in cache and remotely,
|
/* if message does not exist in cache and remotely,
|
||||||
@ -9208,7 +9232,8 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
if (_logging_level > 1)
|
if (_logging_level > 1)
|
||||||
logf(lbs, "MIRROR send entry #%d", message_id);
|
logf(lbs, "MIRROR send entry #%d", message_id);
|
||||||
|
|
||||||
remote_id = submit_message(lbs, list[index], message_id, error_str);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
remote_id = submit_message(lbs, list[index], message_id, error_str);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (remote_id != message_id) {
|
if (remote_id != message_id) {
|
||||||
@ -9220,13 +9245,11 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
message_id, remote_id);
|
message_id, remote_id);
|
||||||
} else if (error_str[0]) {
|
} else if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, "%s: %s\n", loc("Error sending local entry"), error_str);
|
logf(lbs, "%s: %s", loc("Error sending local entry"), error_str);
|
||||||
else
|
else
|
||||||
rsprintf("%s: %s\n", loc("Error sending local entry"), error_str);
|
rsprintf("%s: %s\n", loc("Error sending local entry"), error_str);
|
||||||
} else if (!bcron)
|
} else if (!bcron)
|
||||||
rsprintf("ID%d:\t%s\n", message_id, loc("Local entry submitted"));
|
rsprintf("ID%d:\t%s\n", message_id, loc("Local entry submitted"));
|
||||||
|
|
||||||
md5_cache[i_cache].message_id = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flush_return_buffer();
|
flush_return_buffer();
|
||||||
@ -9255,12 +9278,13 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
logf(lbs, "MIRROR receive entry #%d", message_id);
|
logf(lbs, "MIRROR receive entry #%d", message_id);
|
||||||
|
|
||||||
/* if message does not exist locally and in cache, it is new, so retrieve it */
|
/* if message does not exist locally and in cache, it is new, so retrieve it */
|
||||||
receive_message(lbs, list[index], message_id, error_str, TRUE);
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
receive_message(lbs, list[index], message_id, error_str, TRUE);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
if (bcron)
|
if (bcron)
|
||||||
logf(lbs, "Error receiving message: %s\n", error_str);
|
logf(lbs, "Error receiving message: %s", error_str);
|
||||||
else
|
else
|
||||||
rsprintf("Error receiving message: %s\n", error_str);
|
rsprintf("Error receiving message: %s\n", error_str);
|
||||||
} else if (!bcron)
|
} else if (!bcron)
|
||||||
@ -9273,7 +9297,9 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
|
|
||||||
sprintf(str, "%d?cmd=Delete&confirm=Yes", message_id);
|
sprintf(str, "%d?cmd=Delete&confirm=Yes", message_id);
|
||||||
combine_url(lbs, list[index], str, url, sizeof(url));
|
combine_url(lbs, list[index], str, url, sizeof(url));
|
||||||
retrieve_url(url, &buffer);
|
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str) || atoi(str) == 0)
|
||||||
|
retrieve_url(url, &buffer);
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (strstr(buffer, "Location: ")) {
|
if (strstr(buffer, "Location: ")) {
|
||||||
@ -9298,7 +9324,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
md5_remote = NULL;
|
md5_remote = NULL;
|
||||||
n_remote = retrieve_remote_md5(lbs, list[index], &md5_remote, error_str);
|
n_remote = retrieve_remote_md5(lbs, list[index], &md5_remote, error_str);
|
||||||
if (n_remote < 0)
|
if (n_remote < 0)
|
||||||
rsprintf(error_str);
|
rsprintf("%s\n", error_str);
|
||||||
|
|
||||||
/* keep conflicting messages in cache */
|
/* keep conflicting messages in cache */
|
||||||
for (i = 0; i < n_cache; i++)
|
for (i = 0; i < n_cache; i++)
|
||||||
@ -9338,7 +9364,7 @@ void synchronize_logbook(LOGBOOK * lbs, BOOL bcron)
|
|||||||
void synchronize(LOGBOOK * lbs, BOOL bcron)
|
void synchronize(LOGBOOK * lbs, BOOL bcron)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char str[256];
|
char str[256], pwd[256];
|
||||||
|
|
||||||
if (!bcron) {
|
if (!bcron) {
|
||||||
show_html_header(NULL, FALSE, loc("Synchronization"));
|
show_html_header(NULL, FALSE, loc("Synchronization"));
|
||||||
@ -9354,6 +9380,14 @@ void synchronize(LOGBOOK * lbs, BOOL bcron)
|
|||||||
&& !equal_ustring(lb_list[i].top_group, getcfg_topgroup()))
|
&& !equal_ustring(lb_list[i].top_group, getcfg_topgroup()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* if called by cron, set user name and password */
|
||||||
|
if (bcron && getcfg(lb_list[i].name, "mirror user", str)) {
|
||||||
|
if (get_user_line(lb_list[i].name, str, pwd, NULL, NULL, NULL) == EL_SUCCESS) {
|
||||||
|
setparam("unm", str);
|
||||||
|
setparam("upwd", pwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
synchronize_logbook(&lb_list[i], bcron);
|
synchronize_logbook(&lb_list[i], bcron);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -14903,6 +14937,26 @@ void decode_post(LOGBOOK * lbs, char *string, char *boundary, int length)
|
|||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
BOOL cron_match(char *str, int value, BOOL ignore_star)
|
||||||
|
{
|
||||||
|
int low, high;
|
||||||
|
|
||||||
|
if (atoi(str) == value)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (!ignore_star && str[0] == '*')
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* check range */
|
||||||
|
if (strchr(str, '-')) {
|
||||||
|
low = atoi(str);
|
||||||
|
high = atoi(strchr(str, '-')+1);
|
||||||
|
return value >= low && value <= high;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void check_cron()
|
void check_cron()
|
||||||
/* check 'mirror cron' etnry in configuration file
|
/* check 'mirror cron' etnry in configuration file
|
||||||
|
|
||||||
@ -14917,7 +14971,7 @@ void check_cron()
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i, j, n;
|
int i, j, n;
|
||||||
BOOL flag[5];
|
BOOL min_flag, hour_flag, day_flag, mon_flag, wday_flag;
|
||||||
time_t now;
|
time_t now;
|
||||||
char *p, str[256], cron[5][256];
|
char *p, str[256], cron[5][256];
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
@ -14944,43 +14998,40 @@ void check_cron()
|
|||||||
str[24] = 0;
|
str[24] = 0;
|
||||||
printf("Cron: %s\r", str);
|
printf("Cron: %s\r", str);
|
||||||
|
|
||||||
/* check if last_time is initialized */
|
/* check once every minute */
|
||||||
if (last_time.tm_year) {
|
if (last_time.tm_year && last_time.tm_min != ts->tm_min) {
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
min_flag = hour_flag = day_flag = mon_flag = wday_flag = FALSE;
|
||||||
flag[i] = FALSE;
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
n = strbreak(cron[i], list, 60);
|
n = strbreak(cron[i], list, 60);
|
||||||
if (cron[i][0] == '*')
|
|
||||||
flag[i] = TRUE;
|
for (j = 0; j < n; j++) {
|
||||||
else
|
/* minutes */
|
||||||
for (j = 0; j < n; j++) {
|
if (i == 0 && cron_match(list[j], ts->tm_min, FALSE))
|
||||||
/* minutes */
|
min_flag = TRUE;
|
||||||
if (i == 0 && ts->tm_min != last_time.tm_min
|
|
||||||
&& ts->tm_min == atoi(list[j]))
|
/* hours */
|
||||||
flag[i] = TRUE;
|
if (i == 1 && cron_match(list[j], ts->tm_hour, FALSE))
|
||||||
/* hours */
|
hour_flag = TRUE;
|
||||||
if (i == 1 && ts->tm_hour != last_time.tm_hour
|
|
||||||
&& ts->tm_hour == atoi(list[j]))
|
/* day of month */
|
||||||
flag[i] = TRUE;
|
if (i == 2 && cron_match(list[j], ts->tm_mday, FALSE))
|
||||||
/* day of month */
|
day_flag = TRUE;
|
||||||
if (i == 2 && ts->tm_mday != last_time.tm_mday
|
|
||||||
&& ts->tm_mday == atoi(list[j]))
|
/* month of year */
|
||||||
flag[i] = TRUE;
|
if (i == 3 && cron_match(list[j], ts->tm_mon, FALSE))
|
||||||
/* month of year */
|
mon_flag = TRUE;
|
||||||
if (i == 3 && ts->tm_mon != last_time.tm_mon
|
|
||||||
&& ts->tm_mon + 1 == atoi(list[j]))
|
/* weekday */
|
||||||
flag[i] = TRUE;
|
if (i == 4 && cron_match(list[j], ts->tm_wday, TRUE))
|
||||||
/* weekday */
|
wday_flag = TRUE;
|
||||||
if (i == 4 && ts->tm_wday != last_time.tm_wday
|
}
|
||||||
&& ts->tm_wday == atoi(list[j]))
|
|
||||||
flag[i] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag[0] && flag[1] && flag[2] && flag[3] && flag[4]) {
|
if (min_flag && hour_flag && ((day_flag && mon_flag) || wday_flag)) {
|
||||||
|
|
||||||
|
rem_host[0] = 0;
|
||||||
logf(NULL, "Cron job started");
|
logf(NULL, "Cron job started");
|
||||||
|
|
||||||
/* synchronize all logbooks */
|
/* synchronize all logbooks */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user