struct tm *ftime;
ftime = localtime(&new_l->cl_nextexe);
debug
- (" from last conf: %s next exec %04d-%02d-%02d"
+ (" from last conf: '%s' next exec %04d-%02d-%02d"
" wday:%d %02d:%02d:%02d (system time)",
new_l->cl_shell, (ftime->tm_year + 1900),
(ftime->tm_mon + 1), ftime->tm_mday,
else {
/* job has been stopped during execution :
* launch it again */
- warn("job %s did not finish : running it again.", cl->cl_shell);
+ warn("job '%s' did not finish : running it again.", cl->cl_shell);
set_serial_once(cl->cl_option);
add_serial_job(cl, -1);
}
else {
/* run bootrun jobs */
cl->cl_remain = cl->cl_runfreq;
- debug(" boot-run %s", cl->cl_shell);
+ debug(" boot-run '%s'", cl->cl_shell);
if (!is_lavg(cl->cl_option)) {
set_serial_once(cl->cl_option);
add_serial_job(cl, -1);
if (cl->cl_nextexe < now || cl->cl_nextexe > TIME_T_MAX) {
/* there was an integer overflow! */
error
- ("Error while setting next exe time for job %s: cl_nextexe"
+ ("Error while setting next exe time for job '%s': cl_nextexe"
" overflowed (case1). now=%lu, cl_timefreq=%lu, cl_nextexe=%lu.",
cl->cl_shell, now, cl->cl_timefreq, cl->cl_nextexe);
error
/* 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"
+ ("Error while setting next exe time for job '%s': cl_nextexe"
" 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);
if (debug_opt && !(is_runonce(cl->cl_option) && is_hasrun(cl->cl_option))) {
struct tm *ftime;
ftime = localtime(&(cl->cl_nextexe));
- debug(" cmd %s next exec %04d-%02d-%02d wday:%d %02d:%02d:%02d"
+ debug(" cmd '%s' next exec %04d-%02d-%02d wday:%d %02d:%02d:%02d"
" (system time)",
cl->cl_shell, (ftime->tm_year + 1900), (ftime->tm_mon + 1),
ftime->tm_mday, ftime->tm_wday, ftime->tm_hour, ftime->tm_min,
for (l = lavg_list_first(lavg_list); l != NULL;
l = lavg_list_next(lavg_list))
if (l->l_line->cl_file == file) {
- debug("removing %s from lavg queue", l->l_line->cl_shell);
+ debug("removing '%s' from lavg queue", l->l_line->cl_shell);
lavg_list_remove_cur(lavg_list);
}
alloc_safe(serial_array_size * sizeof(cl_t *),
"serial queue");
}
- debug("removing %s from serial queue",
+ debug("removing '%s' from serial queue",
serial_array[i]->cl_shell);
serial_num--;
serial_array[i]->cl_numexe--;
}
if (is_runonce(j->j_line->cl_option) && is_hasrun(j->j_line->cl_option)) {
- explain("Line %s has runonce set: not re-scheduling it.",
+ explain("Line '%s' has runonce set: not re-scheduling it.",
j->j_line->cl_shell);
job_queue_remove(j->j_line);
}
(is_exe_sev(line->cl_option) && line->cl_numexe < UCHAR_MAX)) {
line->cl_numexe += 1;
run_queue_job(line);
- send_msg_fd(info_fd, "Job %s started.", line->cl_shell);
+ send_msg_fd(info_fd, "Job '%s' started.", line->cl_shell);
}
else {
- warn_fd(info_fd, " process already running: %s's %s",
+ warn_fd(info_fd, " process already running: %s's '%s'",
line->cl_file->cf_user, line->cl_shell);
}
* (we consider serial jobs currently running as in the queue) */
if ((is_serial_sev(line->cl_option) && line->cl_numexe >= UCHAR_MAX) ||
(!is_serial_sev(line->cl_option) && line->cl_numexe > 0)) {
- send_msg_fd_debug(info_fd, "already in serial queue %s",
+ send_msg_fd_debug(info_fd, "already in serial queue '%s'",
line->cl_shell);
return;
}
- send_msg_fd_debug(info_fd, "inserting in serial queue %s", line->cl_shell);
+ send_msg_fd_debug(info_fd, "inserting in serial queue '%s'",
+ line->cl_shell);
if (serial_num >= serial_array_size) {
if (serial_num >= serial_queue_max) {
error_fd(info_fd, "Could not add job : serial queue is full "
"(%d jobs). Consider using option serialonce, fcron's "
- "option -m and/or -q : %s", serial_queue_max,
+ "option -m and/or -q : '%s'", serial_queue_max,
line->cl_shell);
if (is_notice_notrun(line->cl_option))
mail_notrun(line, QUEUE_FULL, NULL);
* (we consider serial jobs currently running as in the queue) */
if ((is_lavg_sev(line->cl_option) && line->cl_numexe >= UCHAR_MAX) ||
(!is_lavg_sev(line->cl_option) && line->cl_numexe > 0)) {
- send_msg_fd_debug(info_fd, "already in lavg queue %s", line->cl_shell);
+ send_msg_fd_debug(info_fd, "already in lavg queue '%s'",
+ line->cl_shell);
return;
}
/* // */
- send_msg_fd_debug(info_fd, "inserting in lavg queue %s", line->cl_shell);
+ send_msg_fd_debug(info_fd, "inserting in lavg queue '%s'", line->cl_shell);
/* // */
/* append job to the list of lavg job */
lavg_entry = lavg_list_add_line(lavg_list, line);
if (lavg_entry == NULL) {
- error_fd(info_fd, "Could not add job : lavg queue is full (%d jobs)."
+ error_fd(info_fd,
+ "Could not add job '%s' : lavg queue is full (%d jobs)."
" Consider using options lavgonce, until, strict and/or "
- "fcron's option -q.", lavg_list->max_entries, line->cl_shell);
+ "fcron's option -q.", line->cl_shell, lavg_list->max_entries);
if (is_notice_notrun(line->cl_option))
mail_notrun(line, QUEUE_FULL, NULL);
return;
}
else {
- debug("job finished: %s", e->e_line->cl_shell);
+ debug("job finished: '%s'", e->e_line->cl_shell);
e->e_line->cl_numexe -= 1;
e->e_line->cl_file->cf_running -= 1;
if (debug_opt)
set_wday(ftime);
- debug(" %s beginning of next period %04d-%02d-%02d wday:%d %02d:%02d "
+ debug(" '%s' beginning of next period %04d-%02d-%02d wday:%d %02d:%02d "
"(tzdiff=%d, timezone=%s)", line->cl_shell, (ftime->tm_year + 1900),
(ftime->tm_mon + 1), ftime->tm_mday, ftime->tm_wday,
ftime->tm_hour, ftime->tm_min, line->cl_file->cf_tzdiff,
ftime->tm_mon = 0;
ftime->tm_year++;
if (--year_limit <= 0) {
- error("Can't found a non matching date for %s "
+ error("Can't found a non matching date for '%s' "
"in the next %d years. Maybe this line "
"is corrupted : consider reinstalling "
"the fcrontab", line->cl_shell,
}
}
- debug(" %s %s %04d-%02d-%02d wday:%d %02d:%02d (tzdiff=%d, timezone=%s)",
- line->cl_shell,
- (where ==
- END_OF_INTERVAL) ? "end of interval" : "begin of next period",
- (ftime->tm_year + 1900), (ftime->tm_mon + 1), ftime->tm_mday,
- ftime->tm_wday, ftime->tm_hour, ftime->tm_min,
- line->cl_file->cf_tzdiff,
- (line->cl_tz != NULL) ? line->cl_tz : "localtime");
+ debug
+ (" '%s' %s %04d-%02d-%02d wday:%d %02d:%02d (tzdiff=%d, timezone=%s)",
+ line->cl_shell,
+ (where ==
+ END_OF_INTERVAL) ? "end of interval" : "begin of next period",
+ (ftime->tm_year + 1900), (ftime->tm_mon + 1), ftime->tm_mday,
+ ftime->tm_wday, ftime->tm_hour, ftime->tm_min,
+ line->cl_file->cf_tzdiff,
+ (line->cl_tz != NULL) ? line->cl_tz : "localtime");
}
if (i >= 12) {
ftime.tm_year++;
if (--year_limit <= 0) {
- error("Can't found a matching date for %s in the next %d"
+ error("Can't found a matching date for '%s' in the next %d"
" years. Maybe this line is corrupted : consider"
" reinstalling the fcrontab.",
line->cl_shell, MAXYEAR_SCHEDULE_TIME);
struct tm int_end;
time_t int_end_timet;
- debug(" cmd: %s begin int exec %04d-%02d-%02d wday:%d %02d:%02d "
- "(tzdiff=%d, timezone=%s)", line->cl_shell,
- (ftime.tm_year + 1900), (ftime.tm_mon + 1), ftime.tm_mday,
- ftime.tm_wday, ftime.tm_hour, ftime.tm_min,
- line->cl_file->cf_tzdiff,
- (line->cl_tz != NULL) ? line->cl_tz : "localtime");
+ debug
+ (" cmd: '%s' begin int exec %04d-%02d-%02d wday:%d %02d:%02d "
+ "(tzdiff=%d, timezone=%s)", line->cl_shell,
+ (ftime.tm_year + 1900), (ftime.tm_mon + 1), ftime.tm_mday,
+ ftime.tm_wday, ftime.tm_hour, ftime.tm_min,
+ line->cl_file->cf_tzdiff,
+ (line->cl_tz != NULL) ? line->cl_tz : "localtime");
memcpy(&int_end, &ftime, sizeof(int_end));
move_time_to(END_OF_INTERVAL, line, &int_end);
memcpy(&ftime, ft, sizeof(ftime));
}
send_msg_fd_debug(info_fd,
- " cmd: %s next exec %04d-%02d-%02d wday:%d "
+ " cmd: '%s' next exec %04d-%02d-%02d wday:%d "
"%02d:%02d:%02d (tzdiff=%d, timezone=%s)",
line->cl_shell, (ftime.tm_year + 1900),
(ftime.tm_mon + 1), ftime.tm_mday, ftime.tm_wday,
* an unknown bug in this function.
*/
if (line->cl_nextexe <= now) {
- error("BUG ??? Fcron thinks the next exe time of %s is %ld, "
+ error("BUG ??? Fcron thinks the next exe time of '%s' is %ld, "
"hence before now (%ld). To avoid infinite loop, nextexe"
" will be set at now+5s.", line->cl_shell, line->cl_nextexe);
line->cl_nextexe = now + 5;
if (line->cl_nextexe <= basetime) {
/* 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. "
- "Did fcron shut down cleanly?",
- line->cl_shell, basetime, line->cl_timefreq,
- line->cl_nextexe);
+ error
+ ("Error while setting next exe time for job '%s': cl_nextexe"
+ " 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 now+cl_timefreq to prevent an infinite loop.");
line->cl_nextexe = now + line->cl_timefreq;
memcpy(&ftime, ft, sizeof(struct tm));
send_msg_fd_debug(info_fd,
- " cmd: %s next exec %04d-%02d-%02d wday:%d "
+ " cmd: '%s' next exec %04d-%02d-%02d wday:%d "
"%02d:%02d:%02d (system time)", line->cl_shell,
(ftime.tm_year + 1900), (ftime.tm_mon + 1),
ftime.tm_mday, ftime.tm_wday, ftime.tm_hour,
int tz_changed = 0;
/* // */
- debug(" set_next_exe_notrun : %s %d", line->cl_shell, context);
+ debug(" set_next_exe_notrun : '%s' %d", line->cl_shell, context);
/* // */
switch (pid = fork()) {
case -1:
- error_e("Fork error : could not mail for not run %s", line->cl_shell);
+ error_e("Fork error : could not mail for not run '%s'", line->cl_shell);
return;
case 0:
/* child */
/* parent */
/* // */
- debug("Reporting by mail non execution of %s (pid %d)",
+ debug("Reporting by mail non execution of '%s' (pid %d)",
line->cl_shell, pid);
/* // */
switch (context) {
case SYSDOWN:
- fprintf(mailf, "Line %s has not run since and including "
+ fprintf(mailf, "Line '%s' has not run since and including "
"%04d-%02d-%02d wday:%d %02d:%02d (timezone=%s)\n"
"due to system's down state.\n",
line->cl_shell, (since->tm_year + 1900), (since->tm_mon + 1),
time.tm_mday, time.tm_wday, time.tm_hour, time.tm_min);
break;
case LAVG:
- fprintf(mailf, "Line %s has not run since and including "
+ fprintf(mailf, "Line '%s' has not run since and including "
"%04d-%02d-%02d wday:%d %02d:%02d (timezone=%s)\n",
line->cl_shell, (since->tm_year + 1900), (since->tm_mon + 1),
since->tm_mday, since->tm_wday, since->tm_hour, since->tm_min,
time.tm_min, (line->cl_tz) ? line->cl_tz : "system's");
break;
case QUEUE_FULL:
- fprintf(mailf, "Line %s couldn't be added to lavg or serial queue which"
+ fprintf(mailf,
+ "Line '%s' couldn't be added to lavg or serial queue which"
" is full ( %04d-%02d-%02d wday:%d %02d:%02d (timezone=%s)).\n",
line->cl_shell, (time.tm_year + 1900), (time.tm_mon + 1),
time.tm_mday, time.tm_wday, time.tm_hour, time.tm_min,
fprintf(mailf,
"Consider using options lavgonce, until, strict, "
"serialonce and/or fcron's option -m.\n");
- fprintf(mailf, "Note that job %s has not run.\n", line->cl_shell);
+ fprintf(mailf, "Note that job '%s' has not run.\n", line->cl_shell);
break;
}
&& l->l_until < now) {
if (!is_run_if_late(l->l_line->cl_option)) {
if (!is_nolog(l->l_line->cl_option))
- explain("Interval of execution exceeded : %s (not run)",
+ explain("Interval of execution exceeded : '%s' (not run)",
l->l_line->cl_shell);
/* set time of the next execution and send a mail if needed */
lavg_list_remove_cur(lavg_list);
}
else {
- debug("until %s %d", l->l_line->cl_shell, l->l_until);
+ debug("until '%s' %d", l->l_line->cl_shell, l->l_until);
run_lavg_job(l);
lavg_list_remove_cur(lavg_list);
}
|| l_avg[2] < l->l_line->cl_lavg[2])
)
) {
- debug("lavg %s %s %.0f:%d %.0f:%d %.0f:%d",
+ debug("lavg '%s' %s %.0f:%d %.0f:%d %.0f:%d",
l->l_line->cl_shell,
(is_lor(l->l_line->cl_option)) ? "or" : "and",
l_avg[0], l->l_line->cl_lavg[0],
retcode = pam_start("fcron", pas->pw_name, &apamconv, &pamh);
if (retcode != PAM_SUCCESS)
- die_pame(pamh, retcode, "Could not start PAM for %s", cl->cl_shell);
+ die_pame(pamh, retcode, "Could not start PAM for '%s'", cl->cl_shell);
/* Some system seem to need that pam_authenticate() call.
* Anyway, we have no way to authentificate the user :
* we must set auth to pam_permit. */
switch (pid = fork()) {
case -1:
- error_e("Fork error : could not exec \"%s\"", line->cl_shell);
+ error_e("Fork error : could not exec '%s'", line->cl_shell);
return ERR;
break;
/* now, run the job */
switch (pid = fork()) {
case -1:
- error_e("Fork error : could not exec \"%s\"", line->cl_shell);
+ error_e("Fork error : could not exec '%s'", line->cl_shell);
if (write(pipe_pid_fd[1], &pid, sizeof(pid)) < 0)
error_e("could not write child pid to pipe_pid_fd[1]");
xclose_check(&(pipe_fd[0]), "child's pipe_fd[0]");
#endif /* CHECKRUNJOB */
if (!is_nolog(line->cl_option))
- explain("Job %s started for user %s (pid %d)",
+ explain("Job '%s' started for user %s (pid %d)",
line->cl_shell, line->cl_file->cf_user, pid);
if (!to_stdout && is_mail(line->cl_option)) {
mailbuf[sizeof(mailbuf) - 1] = '\0';
while (fgets(mailbuf, sizeof(mailbuf), pipef) != NULL)
if (fputs(mailbuf, mailf) < 0)
- warn("fputs() failed to write to mail file for job %s (pid %d)", line->cl_shell, pid);
+ warn("fputs() failed to write to mail file for job '%s' (pid %d)", line->cl_shell, pid);
/* (closes also pipe_fd[0]): */
xfclose_check(&pipef, "child's pipef");
}
m = (mail_output == 1) ? " (mailing output)" : "";
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
if (!is_nolog(line->cl_option))
- explain("Job %s completed%s", line->cl_shell, m);
+ explain("Job '%s' completed%s", line->cl_shell, m);
}
else if (WIFEXITED(status)) {
- warn("Job %s terminated (exit status: %d)%s",
+ warn("Job '%s' terminated (exit status: %d)%s",
line->cl_shell, WEXITSTATUS(status), m);
/* there was an error : in order to inform the user by mail, we need
* to add some data to mailf */
if (mailf != NULL)
- fprintf(mailf, "Job %s terminated (exit status: %d)%s",
+ fprintf(mailf, "Job '%s' terminated (exit status: %d)%s",
line->cl_shell, WEXITSTATUS(status), m);
}
else if (WIFSIGNALED(status)) {
- error("Job %s terminated due to signal %d%s",
+ error("Job '%s' terminated due to signal %d%s",
line->cl_shell, WTERMSIG(status), m);
if (mailf != NULL)
- fprintf(mailf, "Job %s terminated due to signal %d%s",
+ fprintf(mailf, "Job '%s' terminated due to signal %d%s",
line->cl_shell, WTERMSIG(status), m);
}
else { /* is this possible? */
- error("Job %s terminated abnormally %s", line->cl_shell, m);
+ error("Job '%s' terminated abnormally %s", line->cl_shell, m);
if (mailf != NULL)
- fprintf(mailf, "Job %s terminated abnormally %s", line->cl_shell,
+ fprintf(mailf, "Job '%s' terminated abnormally %s", line->cl_shell,
m);
}