Lines Matching refs:cfile
206 static void parse_line(char *line, CRONFILE *cfile) in parse_line() argument
228 if (TT.flagd) loginfo(LOG_LEVEL5, "user:%s entry:%s", cfile->username, line); in parse_line()
279 dlist_add_nomalloc((struct double_list **)&cfile->job, (struct double_list *)j); in parse_line()
286 if (!strcmp(name, "MAILTO")) cfile->mailto = xstrdup(val); in parse_line()
291 dlist_add_nomalloc((struct double_list **)&cfile->var, (struct double_list *)v); in parse_line()
375 CRONFILE *cfile; in scan_cronfiles() local
388 cfile = xzalloc(sizeof(CRONFILE)); in scan_cronfiles()
389 cfile->username = xstrdup(entry->d_name); in scan_cronfiles()
392 parse_line(line, cfile); in scan_cronfiles()
395 if (!cfile->job) { in scan_cronfiles()
396 VAR *v, *vnode = (VAR *)cfile->var; in scan_cronfiles()
398 free(cfile->username); in scan_cronfiles()
399 if (cfile->mailto) free(cfile->mailto); in scan_cronfiles()
406 free(cfile); in scan_cronfiles()
408 if (!cfile->mailto) cfile->mailto = cfile->username; in scan_cronfiles()
410 (struct double_list *)cfile); in scan_cronfiles()
422 static void do_fork(CRONFILE *cfile, JOB *job, int fd, char *prog) in do_fork() argument
427 VAR *v, *vstart = (VAR *)cfile->var; in do_fork()
428 struct passwd *pwd = getpwnam(cfile->username); in do_fork()
430 if (!pwd) loginfo(LOG_LEVEL9, "can't get uid for %s", cfile->username); in do_fork()
459 loginfo(LOG_ERROR, "can't execute '%s' for user %s", file, cfile->username); in do_fork()
474 static void sendmail(CRONFILE *cfile, JOB *job) in sendmail() argument
487 cfile->username, (int)pid); in sendmail()
499 do_fork(cfile, job, mailfd, "sendmail"); in sendmail()
505 CRONFILE *cfile = gclist; in count_running_jobs() local
509 while (cfile) { in count_running_jobs()
510 job = jstart = (JOB *)cfile->job; in count_running_jobs()
518 sendmail(cfile, job); in count_running_jobs()
530 if ((cfile = cfile->next) == gclist) break; in count_running_jobs()
538 CRONFILE *cfile = gclist; in execute_jobs() local
541 while (cfile) { in execute_jobs()
542 job = jstart = (JOB *)cfile->job; in execute_jobs()
551 cfile->username, getpid()); in execute_jobs()
555 "discarding output", toybuf, cfile->username); in execute_jobs()
557 dprintf(mailfd, "To: %s\nSubject: cron: %s\n\n", cfile->mailto, job->cmd); in execute_jobs()
560 do_fork(cfile, job, mailfd, NULL); in execute_jobs()
565 cfile->username, (int)job->pid); in execute_jobs()
571 cfile->username, job->pid, job->cmd); in execute_jobs()
578 if ((cfile = cfile->next) == gclist) break; in execute_jobs()
589 CRONFILE *cfile = gclist; in schedule_jobs() local
595 while (cfile) { in schedule_jobs()
596 if (TT.flagd) loginfo(LOG_LEVEL5, "file %s:", cfile->username); in schedule_jobs()
597 if (cfile->invalid) goto NEXT_CRONFILE; in schedule_jobs()
598 job = jstart = (JOB *)cfile->job; in schedule_jobs()
610 cfile->username, job->cmd); in schedule_jobs()
620 if ((cfile = cfile->next) == gclist) break; in schedule_jobs()