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;
395 // If there is no job for a cron, remove the VAR list.
396 if (!cfile->job) {
419 * Set env variables, if any in the cronfile. Execute given job with the given
421 * completed job (as per the given param 'prog').
423 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog)
459 execlp(file, file, (prog ? "-ti" : "-c"), (prog ? NULL : job->cmd), (char *) NULL);
462 if (!prog) dprintf(1, "Exec failed: %s -c %s\n", file, job->cmd);
471 job->pid = pid;
475 static void sendmail(CRONFILE *cfile, JOB *job)
477 pid_t pid = job->pid;
481 job->pid = 0;
482 if (pid <=0 || job->mailsize <=0) {
483 job->isrunning = 0;
484 job->needstart = 1;
495 || sb.st_size == job->mailsize || !S_ISREG(sb.st_mode)) {
499 job->mailsize = 0;
500 do_fork(cfile, job, mailfd, "sendmail");
507 JOB *job, *jstart;
511 job = jstart = (JOB *)cfile->job;
512 while (job) {
515 if (!job->isrunning || job->pid<=0) goto NEXT_JOB;
516 job->isrunning = 0;
517 ret = waitpid(job->pid, NULL, WNOHANG);
518 if (ret < 0 || ret == job->pid) {
519 sendmail(cfile, job);
520 if (job->pid) count += (job->isrunning=1);
522 job->isrunning = 0;
523 job->needstart = 1;
526 else count += (job->isrunning=1);
529 if ((job = job->next) == jstart) break;
540 JOB *job, *jstart;
543 job = jstart = (JOB *)cfile->job;
544 while (job) {
545 if (job->needstart) {
546 job->needstart = 0;
547 if (job->pid < 0) {
550 job->mailsize = job->pid = 0;
558 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd);
559 job->mailsize = lseek(mailfd, 0, SEEK_CUR);
561 do_fork(cfile, job, mailfd, NULL);
563 if (job->pid <= 0) unlink(toybuf);
566 cfile->username, (int)job->pid);
572 cfile->username, job->pid, job->cmd);
573 if (job->pid < 0) job->needstart = 1;
574 else job->isrunning = 1;
577 if ((job = job->next) == jstart) break;
591 JOB *job, *jstart;
599 job = jstart = (JOB *)cfile->job;
601 while (job) {
602 if (TT.flagd) loginfo(LOG_LEVEL5, " line %s", job->cmd);
604 if (job->min[lt->tm_min] && job->hour[lt->tm_hour]
605 && (job->dom[lt->tm_mday] || job->dow[lt->tm_wday])
606 && job->mon[lt->tm_mon-1]) {
608 loginfo(LOG_LEVEL5, " job: %d %s\n", (int)job->pid, job->cmd);
609 if (job->pid > 0) {
611 cfile->username, job->cmd);
612 } else if (!job->pid) {
613 job->pid = -1;
614 job->needstart = 1;
615 job->isrunning = 0;
618 if ((job = job->next) == jstart) break;