Lines Matching refs:cfile
207 static void parse_line(char *line, CRONFILE *cfile) in parse_line() argument
229 if (TT.flagd) loginfo(LOG_LEVEL5, "user:%s entry:%s", cfile->username, line); in parse_line()
280 dlist_add_nomalloc((struct double_list **)&cfile->job, (struct double_list *)j); in parse_line()
287 if (!strcmp(name, "MAILTO")) cfile->mailto = xstrdup(val); in parse_line()
292 dlist_add_nomalloc((struct double_list **)&cfile->var, (struct double_list *)v); in parse_line()
376 CRONFILE *cfile; in scan_cronfiles() local
389 cfile = xzalloc(sizeof(CRONFILE)); in scan_cronfiles()
390 cfile->username = xstrdup(entry->d_name); in scan_cronfiles()
393 parse_line(line, cfile); in scan_cronfiles()
396 if (!cfile->job) { in scan_cronfiles()
397 VAR *v, *vnode = (VAR *)cfile->var; in scan_cronfiles()
399 free(cfile->username); in scan_cronfiles()
400 if (cfile->mailto) free(cfile->mailto); in scan_cronfiles()
407 free(cfile); in scan_cronfiles()
409 if (!cfile->mailto) cfile->mailto = cfile->username; in scan_cronfiles()
411 (struct double_list *)cfile); in scan_cronfiles()
423 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog) in do_fork() argument
428 VAR *v, *vstart = (VAR *)cfile->var; in do_fork()
429 struct passwd *pwd = getpwnam(cfile->username); in do_fork()
431 if (!pwd) loginfo(LOG_LEVEL9, "can't get uid for %s", cfile->username); in do_fork()
460 loginfo(LOG_ERROR, "can't execute '%s' for user %s", file, cfile->username); in do_fork()
475 static void sendmail(CRONFILE *cfile, JOB *job) in sendmail() argument
488 cfile->username, (int)pid); in sendmail()
500 do_fork(cfile, job, mailfd, "sendmail"); in sendmail()
506 CRONFILE *cfile = gclist; in count_running_jobs() local
510 while (cfile) { in count_running_jobs()
511 job = jstart = (JOB *)cfile->job; in count_running_jobs()
519 sendmail(cfile, job); in count_running_jobs()
531 if ((cfile = cfile->next) == gclist) break; in count_running_jobs()
539 CRONFILE *cfile = gclist; in execute_jobs() local
542 while (cfile) { in execute_jobs()
543 job = jstart = (JOB *)cfile->job; in execute_jobs()
552 cfile->username, getpid()); in execute_jobs()
556 "discarding output", toybuf, cfile->username); in execute_jobs()
558 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd); in execute_jobs()
561 do_fork(cfile, job, mailfd, NULL); in execute_jobs()
566 cfile->username, (int)job->pid); in execute_jobs()
572 cfile->username, job->pid, job->cmd); in execute_jobs()
579 if ((cfile = cfile->next) == gclist) break; in execute_jobs()
590 CRONFILE *cfile = gclist; in schedule_jobs() local
596 while (cfile) { in schedule_jobs()
597 if (TT.flagd) loginfo(LOG_LEVEL5, "file %s:", cfile->username); in schedule_jobs()
598 if (cfile->invalid) goto NEXT_CRONFILE; in schedule_jobs()
599 job = jstart = (JOB *)cfile->job; in schedule_jobs()
611 cfile->username, job->cmd); in schedule_jobs()
621 if ((cfile = cfile->next) == gclist) break; in schedule_jobs()