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