Lines Matching refs:job

53   struct double_list *job, *var;
280 dlist_add_nomalloc((struct double_list **)&cfile->job, (struct double_list *)j);
329 JOB *jstart, *jlist = (JOB *)list->job;
348 list->job = (struct double_list *)jlist;
398 // If there is no job for a cron, remove the VAR list.
399 if (!cfile->job) {
421 * Set env variables, if any in the cronfile. Execute given job with the given
423 * completed job (as per the given param 'prog').
425 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog)
461 execlp(file, file, (prog ? "-ti" : "-c"), (prog ? NULL : job->cmd), (char *) NULL);
464 if (!prog) dprintf(1, "Exec failed: %s -c %s\n", file, job->cmd);
473 job->pid = pid;
477 static void sendmail(CRONFILE *cfile, JOB *job)
479 pid_t pid = job->pid;
483 job->pid = 0;
484 if (pid <=0 || job->mailsize <=0) {
485 job->isrunning = 0;
486 job->needstart = 1;
497 || sb.st_size == job->mailsize || !S_ISREG(sb.st_mode)) {
501 job->mailsize = 0;
502 do_fork(cfile, job, mailfd, "sendmail");
509 JOB *job, *jstart;
513 job = jstart = (JOB *)cfile->job;
514 while (job) {
517 if (!job->isrunning || job->pid<=0) goto NEXT_JOB;
518 job->isrunning = 0;
519 ret = waitpid(job->pid, NULL, WNOHANG);
520 if (ret < 0 || ret == job->pid) {
521 sendmail(cfile, job);
522 if (job->pid) count += (job->isrunning=1);
524 job->isrunning = 0;
525 job->needstart = 1;
528 else count += (job->isrunning=1);
531 if ((job = job->next) == jstart) break;
542 JOB *job, *jstart;
545 job = jstart = (JOB *)cfile->job;
546 while (job) {
547 if (job->needstart) {
548 job->needstart = 0;
549 if (job->pid < 0) {
552 job->mailsize = job->pid = 0;
560 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd);
561 job->mailsize = lseek(mailfd, 0, SEEK_CUR);
563 do_fork(cfile, job, mailfd, NULL);
565 if (job->pid <= 0) unlink(toybuf);
568 cfile->username, (int)job->pid);
574 cfile->username, job->pid, job->cmd);
575 if (job->pid < 0) job->needstart = 1;
576 else job->isrunning = 1;
579 if ((job = job->next) == jstart) break;
593 JOB *job, *jstart;
601 job = jstart = (JOB *)cfile->job;
603 while (job) {
604 if (TT.flagd) loginfo(LOG_LEVEL5, " line %s", job->cmd);
606 if (job->min[lt->tm_min] && job->hour[lt->tm_hour]
607 && (job->dom[lt->tm_mday] || job->dow[lt->tm_wday])
608 && job->mon[lt->tm_mon-1]) {
610 loginfo(LOG_LEVEL5, " job: %d %s\n", (int)job->pid, job->cmd);
611 if (job->pid > 0) {
613 cfile->username, job->cmd);
614 } else if (!job->pid) {
615 job->pid = -1;
616 job->needstart = 1;
617 job->isrunning = 0;
620 if ((job = job->next) == jstart) break;