• Home
  • Raw
  • Download

Lines Matching refs:job

53   struct double_list *job, *var;  member
280 dlist_add_nomalloc((struct double_list **)&cfile->job, (struct double_list *)j); in parse_line()
329 JOB *jstart, *jlist = (JOB *)list->job; in remove_completed_jobs()
348 list->job = (struct double_list *)jlist; in remove_completed_jobs()
396 if (!cfile->job) { in scan_cronfiles()
423 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog) in do_fork() argument
459 execlp(file, file, (prog ? "-ti" : "-c"), (prog ? NULL : job->cmd), (char *) NULL); in do_fork()
462 if (!prog) dprintf(1, "Exec failed: %s -c %s\n", file, job->cmd); in do_fork()
471 job->pid = pid; in do_fork()
475 static void sendmail(CRONFILE *cfile, JOB *job) in sendmail() argument
477 pid_t pid = job->pid; in sendmail()
481 job->pid = 0; in sendmail()
482 if (pid <=0 || job->mailsize <=0) { in sendmail()
483 job->isrunning = 0; in sendmail()
484 job->needstart = 1; in sendmail()
495 || sb.st_size == job->mailsize || !S_ISREG(sb.st_mode)) { in sendmail()
499 job->mailsize = 0; in sendmail()
500 do_fork(cfile, job, mailfd, "sendmail"); in sendmail()
507 JOB *job, *jstart; in count_running_jobs() local
511 job = jstart = (JOB *)cfile->job; in count_running_jobs()
512 while (job) { in count_running_jobs()
515 if (!job->isrunning || job->pid<=0) goto NEXT_JOB; in count_running_jobs()
516 job->isrunning = 0; in count_running_jobs()
517 ret = waitpid(job->pid, NULL, WNOHANG); in count_running_jobs()
518 if (ret < 0 || ret == job->pid) { in count_running_jobs()
519 sendmail(cfile, job); in count_running_jobs()
520 if (job->pid) count += (job->isrunning=1); in count_running_jobs()
522 job->isrunning = 0; in count_running_jobs()
523 job->needstart = 1; in count_running_jobs()
526 else count += (job->isrunning=1); in count_running_jobs()
529 if ((job = job->next) == jstart) break; in count_running_jobs()
540 JOB *job, *jstart; in execute_jobs() local
543 job = jstart = (JOB *)cfile->job; in execute_jobs()
544 while (job) { in execute_jobs()
545 if (job->needstart) { in execute_jobs()
546 job->needstart = 0; in execute_jobs()
547 if (job->pid < 0) { in execute_jobs()
550 job->mailsize = job->pid = 0; in execute_jobs()
558 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd); in execute_jobs()
559 job->mailsize = lseek(mailfd, 0, SEEK_CUR); in execute_jobs()
561 do_fork(cfile, job, mailfd, NULL); in execute_jobs()
563 if (job->pid <= 0) unlink(toybuf); in execute_jobs()
566 cfile->username, (int)job->pid); in execute_jobs()
572 cfile->username, job->pid, job->cmd); in execute_jobs()
573 if (job->pid < 0) job->needstart = 1; in execute_jobs()
574 else job->isrunning = 1; in execute_jobs()
577 if ((job = job->next) == jstart) break; in execute_jobs()
591 JOB *job, *jstart; in schedule_jobs() local
599 job = jstart = (JOB *)cfile->job; in schedule_jobs()
601 while (job) { in schedule_jobs()
602 if (TT.flagd) loginfo(LOG_LEVEL5, " line %s", job->cmd); in schedule_jobs()
604 if (job->min[lt->tm_min] && job->hour[lt->tm_hour] in schedule_jobs()
605 && (job->dom[lt->tm_mday] || job->dow[lt->tm_wday]) in schedule_jobs()
606 && job->mon[lt->tm_mon-1]) { in schedule_jobs()
608 loginfo(LOG_LEVEL5, " job: %d %s\n", (int)job->pid, job->cmd); in schedule_jobs()
609 if (job->pid > 0) { in schedule_jobs()
611 cfile->username, job->cmd); in schedule_jobs()
612 } else if (!job->pid) { in schedule_jobs()
613 job->pid = -1; in schedule_jobs()
614 job->needstart = 1; in schedule_jobs()
615 job->isrunning = 0; in schedule_jobs()
618 if ((job = job->next) == jstart) break; in schedule_jobs()