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()
374 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()
399 if (!cfile->job) { in scan_cronfiles()
400 VAR *v, *vnode = (VAR *)cfile->var; in scan_cronfiles()
402 free(cfile->username); in scan_cronfiles()
403 if (cfile->mailto) free(cfile->mailto); in scan_cronfiles()
410 free(cfile); in scan_cronfiles()
412 if (!cfile->mailto) cfile->mailto = cfile->username; in scan_cronfiles()
414 (struct double_list *)cfile); in scan_cronfiles()
425 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog) in do_fork() argument
430 VAR *v, *vstart = (VAR *)cfile->var; in do_fork()
431 struct passwd *pwd = getpwnam(cfile->username); in do_fork()
433 if (!pwd) loginfo(LOG_LEVEL9, "can't get uid for %s", cfile->username); in do_fork()
462 loginfo(LOG_ERROR, "can't execute '%s' for user %s", file, cfile->username); in do_fork()
477 static void sendmail(CRONFILE *cfile, JOB *job) in sendmail() argument
490 cfile->username, (int)pid); in sendmail()
502 do_fork(cfile, job, mailfd, "sendmail"); in sendmail()
508 CRONFILE *cfile = gclist; in count_running_jobs() local
512 while (cfile) { in count_running_jobs()
513 job = jstart = (JOB *)cfile->job; in count_running_jobs()
521 sendmail(cfile, job); in count_running_jobs()
533 if ((cfile = cfile->next) == gclist) break; in count_running_jobs()
541 CRONFILE *cfile = gclist; in execute_jobs() local
544 while (cfile) { in execute_jobs()
545 job = jstart = (JOB *)cfile->job; in execute_jobs()
554 cfile->username, getpid()); in execute_jobs()
558 "discarding output", toybuf, cfile->username); in execute_jobs()
560 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd); in execute_jobs()
563 do_fork(cfile, job, mailfd, NULL); in execute_jobs()
568 cfile->username, (int)job->pid); in execute_jobs()
574 cfile->username, job->pid, job->cmd); in execute_jobs()
581 if ((cfile = cfile->next) == gclist) break; in execute_jobs()
592 CRONFILE *cfile = gclist; in schedule_jobs() local
598 while (cfile) { in schedule_jobs()
599 if (TT.flagd) loginfo(LOG_LEVEL5, "file %s:", cfile->username); in schedule_jobs()
600 if (cfile->invalid) goto NEXT_CRONFILE; in schedule_jobs()
601 job = jstart = (JOB *)cfile->job; in schedule_jobs()
613 cfile->username, job->cmd); in schedule_jobs()
623 if ((cfile = cfile->next) == gclist) break; in schedule_jobs()