#include "gwcrontab.h"
#include "daemon.h"
#include "log.h"
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <syslog.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <assert.h>
Defines | |
#define | debug(prg) { if (debug_flag) { prg } } |
Run debug code if debugging is enabled. | |
Functions | |
gwcron_job * | get_first_job (gwcron_job *queue, int time) |
Return the first job in the queue due to be executed from the current time onwards. | |
int | append_job (gwcron_job **queue, int time, const char *cmd) |
Add a job into a job queue, inserting it into the linked list at the right chronological point. | |
void | flush_jobs (gwcron_job *queue) |
Clear up and free all the entries in a job queue. | |
void | dump_jobs (gwcron_job *job) |
Dump a job queue to standard out for debug purposes. | |
int | read_crontab () |
Read in the jobs file and parse it into a chronologically ordered single linked list. | |
int | read_minutes (struct timeval *tv) |
Calculate the number of minutes into the day the given time is. | |
int | read_day (struct timeval *tv) |
Determine the day of the year we are on. | |
Variables | |
const int | debug_flag = 0 |
Control whether debug code is run. | |
const char * | etc_directory = ETCDIR |
Directory where config files are stored. | |
const char * | crontab_file = "/gwcrontab" |
File name of config file containing jobs list. | |
gwcron_job * | job_queue = NULL |
Pointer to chronologically ordered linked list of daily jobs. |
Copyright (C) 2004 Alistair Riddoch, The University of Southampton
|
Add a job into a job queue, inserting it into the linked list at the right chronological point.
|
|
Return the first job in the queue due to be executed from the current time onwards. This should be called whenever the config file has been read in.
|
|
Determine the day of the year we are on. Used to make sure we have got to the next day when there are no jobs left today.
|
|
Calculate the number of minutes into the day the given time is.
|
|
Control whether debug code is run. Set to non-zero if debug code should be run. |