]> granicus.if.org Git - fcron/blob - cl.h
Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/fcron/fcron
[fcron] / cl.h
1 /*
2  * FCRON - periodic command scheduler
3  *
4  *  Copyright 2000-2014 Thibault Godouet <fcron@free.fr>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  The GNU General Public License can also be found in the file
21  *  `LICENSE' that comes with the fcron source distribution.
22  */
23
24 /* cl: Cron Line type and associated functions */
25
26 #ifndef __CL_H__
27 #define __CL_H__
28
29 /*
30  * TYPES
31  */
32
33 #define OPTION_SIZE 4           /* number of bytes to hold the cl_option bit array */
34 #define LAVG_SIZE 3
35 /* warning : do not change the order of the members of this structure
36  *   because some tests made are dependent to that order */
37 /* warning : if you change a field type, you may have to also make some changes
38  *   in the save/load binary fcrontab functions */
39 typedef struct cl_t {
40     struct cl_t *cl_next;
41     struct cf_t *cl_file;       /* the file in which the line is           */
42     char *cl_shell;             /* shell command                           */
43     char *cl_runas;             /* determine permissions of the job        */
44     char *cl_mailto;            /* mail output to cl_mailto                */
45     char *cl_tz;                /* time zone of the line                   */
46     unsigned long cl_id;        /* line's unique id number                 */
47     time_t cl_until;            /* timeout of the wait for a lavg value    */
48     time_t cl_first;            /* initial delay preserved for volatile entries */
49     time_t cl_nextexe;          /* time and date of the next execution     */
50     long int cl_timefreq;       /* Run every n seconds                     */
51     unsigned short cl_remain;   /* remaining until next execution          */
52     unsigned short cl_runfreq;  /* Run once every n matches(=1 for %-lines) */
53     unsigned char cl_option[OPTION_SIZE];       /* line's option (see option.h)   */
54     unsigned char cl_lavg[LAVG_SIZE];   /*load averages needed (1,5,15 mins)   */
55     unsigned char cl_numexe;    /* entries in queues & running processes   */
56     char cl_nice;               /* nice value to control priority          */
57     unsigned char cl_jitter;    /* run randomly late up to jitter seconds  */
58     /* see bitstring(3) man page for more details */
59     bitstr_t bit_decl(cl_mins, 60);     /* 0-59                            */
60     bitstr_t bit_decl(cl_hrs, 24);      /* 0-23                            */
61     bitstr_t bit_decl(cl_days, 32);     /* 1-31                            */
62     bitstr_t bit_decl(cl_mons, 12);     /* 0-11                            */
63     bitstr_t bit_decl(cl_dow, 8);       /* 0-7, 0 and 7 are both Sunday    */
64 } cl_t;
65
66
67 /*
68  * functions prototypes
69  */
70
71 /* duplicate a line, including strings it points to */
72 cl_t *dups_cl(cl_t * orig);
73 void free_line(cl_t * cl);
74
75 #endif                          /* __CL_H__ */