jr 154 anacron/global.h int consider_job(job_rec *jr); jr 155 anacron/global.h void unlock(job_rec *jr); jr 156 anacron/global.h void update_timestamp(job_rec *jr); jr 157 anacron/global.h void fake_job(job_rec *jr); jr 161 anacron/global.h void launch_job(job_rec *jr); jr 40 anacron/lock.c open_tsfile(job_rec *jr) jr 43 anacron/lock.c jr->timestamp_fd = open(jr->ident, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); jr 44 anacron/lock.c if (jr->timestamp_fd == -1) jr 45 anacron/lock.c die_e("Can't open timestamp file for job %s", jr->ident); jr 46 anacron/lock.c fcntl(jr->timestamp_fd, F_SETFD, 1); /* set close-on-exec flag */ jr 49 anacron/lock.c if (fchown(jr->timestamp_fd, getuid(), getgid())) jr 50 anacron/lock.c die_e("Can't chown timestamp file %s", jr->ident); jr 51 anacron/lock.c if (fchmod(jr->timestamp_fd, S_IRUSR | S_IWUSR)) jr 52 anacron/lock.c die_e("Can't chmod timestamp file %s", jr->ident); jr 77 anacron/lock.c consider_job(job_rec *jr) jr 86 anacron/lock.c open_tsfile(jr); jr 89 anacron/lock.c b = read(jr->timestamp_fd, timestamp, 8); jr 90 anacron/lock.c if (b == -1) die_e("Error reading timestamp file %s", jr->ident); jr 112 anacron/lock.c if (day_delta >= 0 && day_delta < jr->period) jr 115 anacron/lock.c xclose(jr->timestamp_fd); jr 123 anacron/lock.c if (jr->named_period) jr 126 anacron/lock.c switch (jr->named_period) jr 145 anacron/lock.c die ("Unknown named period for %s (%d)", jr->ident, jr->named_period); jr 151 anacron/lock.c xclose (jr->timestamp_fd); jr 156 anacron/lock.c jobtime = start_sec + jr->delay * 60; jr 160 anacron/lock.c Debug(("The job's %s preferred hour %d was missed, skipping the job.", jr->ident, preferred_hour)); jr 161 anacron/lock.c xclose (jr->timestamp_fd); jr 169 anacron/lock.c jr->ident, range_start, range_stop)); jr 170 anacron/lock.c xclose (jr->timestamp_fd); jr 176 anacron/lock.c if (lock_file(jr->timestamp_fd)) return 1; /* success */ jr 179 anacron/lock.c xclose(jr->timestamp_fd); jr 180 anacron/lock.c explain("Job `%s' locked by another anacron - skipping", jr->ident); jr 185 anacron/lock.c unlock(job_rec *jr) jr 187 anacron/lock.c xclose(jr->timestamp_fd); jr 191 anacron/lock.c update_timestamp(job_rec *jr) jr 202 anacron/lock.c if (lseek(jr->timestamp_fd, 0, SEEK_SET)) jr 203 anacron/lock.c die_e("Can't lseek timestamp file for job %s", jr->ident); jr 204 anacron/lock.c if (write(jr->timestamp_fd, stamp, 9) != 9) jr 205 anacron/lock.c die_e("Can't write timestamp file for job %s", jr->ident); jr 206 anacron/lock.c if (ftruncate(jr->timestamp_fd, 9)) jr 211 anacron/lock.c fake_job(job_rec *jr) jr 214 anacron/lock.c open_tsfile(jr); jr 215 anacron/lock.c update_timestamp(jr); jr 216 anacron/lock.c xclose(jr->timestamp_fd); jr 376 anacron/main.c time_till(job_rec *jr) jr 385 anacron/main.c tj = start_sec + (time_t)jr->delay * 60; jr 390 anacron/main.c jr->ident); jr 166 anacron/readtab.c job_rec *jr; jr 180 anacron/readtab.c jr = obstack_alloc(&tab_o, sizeof(job_rec)); jr 181 anacron/readtab.c if (jr == NULL) { jr 184 anacron/readtab.c jr->period = period; jr 185 anacron/readtab.c jr->named_period = 0; jr 187 anacron/readtab.c jr->delay = delay; jr 188 anacron/readtab.c jr->tab_line = line_num; jr 189 anacron/readtab.c jr->ident = obstack_alloc(&tab_o, ident_len + 1); jr 190 anacron/readtab.c if (jr->ident == NULL) { jr 193 anacron/readtab.c strcpy(jr->ident, ident); jr 194 anacron/readtab.c jr->arg_num = job_arg_num(ident); jr 195 anacron/readtab.c jr->command = obstack_alloc(&tab_o, command_len + 1); jr 196 anacron/readtab.c if (jr->command == NULL) { jr 199 anacron/readtab.c strcpy(jr->command, command); jr 200 anacron/readtab.c jr->job_pid = jr->mailer_pid = 0; jr 201 anacron/readtab.c if (last_job_rec != NULL) last_job_rec->next = jr; jr 202 anacron/readtab.c else first_job_rec = jr; jr 203 anacron/readtab.c last_job_rec = jr; jr 204 anacron/readtab.c jr->prev_env_rec = last_env_rec; jr 205 anacron/readtab.c jr->next = NULL; jr 207 anacron/readtab.c jr->period, jr->delay, jr->ident, jr->command)); jr 216 anacron/readtab.c job_rec *jr; jr 230 anacron/readtab.c jr = obstack_alloc(&tab_o, sizeof(job_rec)); jr 231 anacron/readtab.c if (jr == NULL) { jr 235 anacron/readtab.c jr->named_period = 1; jr 237 anacron/readtab.c jr->named_period = 2; jr 239 anacron/readtab.c jr->named_period = 3; jr 241 anacron/readtab.c jr->named_period = 4; jr 246 anacron/readtab.c jr->period = 0; jr 248 anacron/readtab.c jr->delay = delay; jr 249 anacron/readtab.c jr->tab_line = line_num; jr 250 anacron/readtab.c jr->ident = obstack_alloc(&tab_o, ident_len + 1); jr 251 anacron/readtab.c if (jr->ident == NULL) { jr 254 anacron/readtab.c strcpy(jr->ident, ident); jr 255 anacron/readtab.c jr->arg_num = job_arg_num(ident); jr 256 anacron/readtab.c jr->command = obstack_alloc(&tab_o, command_len + 1); jr 257 anacron/readtab.c if (jr->command == NULL) { jr 260 anacron/readtab.c strcpy(jr->command, command); jr 261 anacron/readtab.c jr->job_pid = jr->mailer_pid = 0; jr 262 anacron/readtab.c if (last_job_rec != NULL) last_job_rec->next = jr; jr 263 anacron/readtab.c else first_job_rec = jr; jr 264 anacron/readtab.c last_job_rec = jr; jr 265 anacron/readtab.c jr->prev_env_rec = last_env_rec; jr 266 anacron/readtab.c jr->next = NULL; jr 268 anacron/readtab.c jr->named_period, jr->delay, jr->ident, jr->command)); jr 42 anacron/runjob.c temp_file(job_rec *jr) jr 70 anacron/runjob.c jr->input_fd = fdin; jr 71 anacron/runjob.c jr->output_fd = fdout; jr 148 anacron/runjob.c setup_env(const job_rec *jr) jr 154 anacron/runjob.c if (er == NULL || jr->prev_env_rec == NULL) return; jr 156 anacron/runjob.c while (er != jr->prev_env_rec) jr 164 anacron/runjob.c run_job(const job_rec *jr) jr 170 anacron/runjob.c if (dup2(jr->output_fd, 1) != 1 || dup2(jr->output_fd, 2) != 2) jr 178 anacron/runjob.c execl("/bin/sh", "/bin/sh", "-c", jr->command, (char *)NULL); jr 206 anacron/runjob.c launch_mailer(job_rec *jr) jr 211 anacron/runjob.c if (jr->mailto == NULL) jr 231 anacron/runjob.c if (dup2(jr->input_fd, STDIN_FILENO) != 0) die_e("Can't dup2()"); jr 240 anacron/runjob.c xclose(jr->output_fd); jr 251 anacron/runjob.c jr->mailto, (char *)NULL); jr 256 anacron/runjob.c jr->mailer_pid = pid; jr 261 anacron/runjob.c tend_mailer(job_rec *jr, int status) jr 266 anacron/runjob.c jr->ident, WEXITSTATUS(status)); jr 270 anacron/runjob.c jr->ident, WTERMSIG(status)); jr 274 anacron/runjob.c , jr->ident); jr 276 anacron/runjob.c jr->mailer_pid = 0; jr 281 anacron/runjob.c launch_job(job_rec *jr) jr 294 anacron/runjob.c setup_env(jr); jr 308 anacron/runjob.c temp_file(jr); fd = jr->output_fd; jr 322 anacron/runjob.c xwrite(fd, jr->ident); jr 328 anacron/runjob.c jr->mailto = NULL; jr 331 anacron/runjob.c jr->mailto = mailto; jr 333 anacron/runjob.c jr->mail_header_size = file_size(fd); jr 340 anacron/runjob.c run_job(jr); jr 344 anacron/runjob.c explain("Job `%s' started", jr->ident); jr 345 anacron/runjob.c jr->job_pid = pid; jr 350 anacron/runjob.c tend_job(job_rec *jr, int status) jr 356 anacron/runjob.c update_timestamp(jr); jr 357 anacron/runjob.c unlock(jr); jr 358 anacron/runjob.c if (file_size(jr->output_fd) > jr->mail_header_size) mail_output = 1; jr 363 anacron/runjob.c explain("Job `%s' terminated%s", jr->ident, m); jr 366 anacron/runjob.c jr->ident, WEXITSTATUS(status), m); jr 369 anacron/runjob.c jr->ident, WTERMSIG(status), m); jr 371 anacron/runjob.c complain("Job `%s' terminated abnormally%s", jr->ident, m); jr 373 anacron/runjob.c jr->job_pid = 0; jr 375 anacron/runjob.c if (mail_output) launch_mailer(jr); jr 376 anacron/runjob.c xclose(jr->output_fd); jr 377 anacron/runjob.c xclose(jr->input_fd);