• 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()
399 if (!cfile->job) { in scan_cronfiles()
425 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog) in do_fork() argument
461 execlp(file, file, (prog ? "-ti" : "-c"), (prog ? NULL : job->cmd), (char *) NULL); in do_fork()
464 if (!prog) dprintf(1, "Exec failed: %s -c %s\n", file, job->cmd); in do_fork()
473 job->pid = pid; in do_fork()
477 static void sendmail(CRONFILE *cfile, JOB *job) in sendmail() argument
479 pid_t pid = job->pid; in sendmail()
483 job->pid = 0; in sendmail()
484 if (pid <=0 || job->mailsize <=0) { in sendmail()
485 job->isrunning = 0; in sendmail()
486 job->needstart = 1; in sendmail()
497 || sb.st_size == job->mailsize || !S_ISREG(sb.st_mode)) { in sendmail()
501 job->mailsize = 0; in sendmail()
502 do_fork(cfile, job, mailfd, "sendmail"); in sendmail()
509 JOB *job, *jstart; in count_running_jobs() local
513 job = jstart = (JOB *)cfile->job; in count_running_jobs()
514 while (job) { in count_running_jobs()
517 if (!job->isrunning || job->pid<=0) goto NEXT_JOB; in count_running_jobs()
518 job->isrunning = 0; in count_running_jobs()
519 ret = waitpid(job->pid, NULL, WNOHANG); in count_running_jobs()
520 if (ret < 0 || ret == job->pid) { in count_running_jobs()
521 sendmail(cfile, job); in count_running_jobs()
522 if (job->pid) count += (job->isrunning=1); in count_running_jobs()
524 job->isrunning = 0; in count_running_jobs()
525 job->needstart = 1; in count_running_jobs()
528 else count += (job->isrunning=1); in count_running_jobs()
531 if ((job = job->next) == jstart) break; in count_running_jobs()
542 JOB *job, *jstart; in execute_jobs() local
545 job = jstart = (JOB *)cfile->job; in execute_jobs()
546 while (job) { in execute_jobs()
547 if (job->needstart) { in execute_jobs()
548 job->needstart = 0; in execute_jobs()
549 if (job->pid < 0) { in execute_jobs()
552 job->mailsize = job->pid = 0; in execute_jobs()
560 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd); in execute_jobs()
561 job->mailsize = lseek(mailfd, 0, SEEK_CUR); in execute_jobs()
563 do_fork(cfile, job, mailfd, NULL); in execute_jobs()
565 if (job->pid <= 0) unlink(toybuf); in execute_jobs()
568 cfile->username, (int)job->pid); in execute_jobs()
574 cfile->username, job->pid, job->cmd); in execute_jobs()
575 if (job->pid < 0) job->needstart = 1; in execute_jobs()
576 else job->isrunning = 1; in execute_jobs()
579 if ((job = job->next) == jstart) break; in execute_jobs()
593 JOB *job, *jstart; in schedule_jobs() local
601 job = jstart = (JOB *)cfile->job; in schedule_jobs()
603 while (job) { in schedule_jobs()
604 if (TT.flagd) loginfo(LOG_LEVEL5, " line %s", job->cmd); in schedule_jobs()
606 if (job->min[lt->tm_min] && job->hour[lt->tm_hour] in schedule_jobs()
607 && (job->dom[lt->tm_mday] || job->dow[lt->tm_wday]) in schedule_jobs()
608 && job->mon[lt->tm_mon-1]) { in schedule_jobs()
610 loginfo(LOG_LEVEL5, " job: %d %s\n", (int)job->pid, job->cmd); in schedule_jobs()
611 if (job->pid > 0) { in schedule_jobs()
613 cfile->username, job->cmd); in schedule_jobs()
614 } else if (!job->pid) { in schedule_jobs()
615 job->pid = -1; in schedule_jobs()
616 job->needstart = 1; in schedule_jobs()
617 job->isrunning = 0; in schedule_jobs()
620 if ((job = job->next) == jstart) break; in schedule_jobs()