]> granicus.if.org Git - fcron/blob - save.h
Close pipe in job.c even if there is an error reading it, to avoid a fd leak (thanks...
[fcron] / save.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
25 #ifndef __SAVE_H__
26 #define __SAVE_H__
27
28 /* functions defined by save.c */
29 extern int write_file_to_disk(int fd, struct cf_t *file, time_t time_date);
30 extern int save_file_safe(cf_t * file, char *final_path, char *prog_name,
31                           uid_t own_uid, gid_t own_gid, time_t save_date);
32
33
34 /* here is the format fcron(tab) uses to save the fcrontabs :
35  *   type(short int)
36  *   size(short int)
37  *   data
38  * unless for some special tags, which don't have data (size set to 0) */
39
40
41 /* kept for backward compatibility : we now have an extended
42  * save format with no use of such a fileversion (unless to know that
43  * the save file is in extended format, not an old one) */
44 #define S_FILEVERSION 100       /* syntax's version of fcrontabs */
45
46
47 /* type constants : DO NOT REMOVE ANY of them : they are used for backward
48  *                  compatibility.
49  *                  If necessary, add some. */
50
51 /* type is an unsigned short int */
52
53 /* header file types */
54 #define S_HEADER_T     1        /* file version */
55 #define S_USER_T       2        /* name of the fcrontab's owner */
56 #define S_TIMEDATE_T   3        /* time and date of saving */
57 #define S_TZDIFF_T     4        /* time diff between the local and system hour */
58
59 /* env var */
60 #define S_ENVVAR_T     1000     /* an environment variable */
61
62 /* line field types */
63 #define S_ENDLINE_T    2000     /* we need to know where a new line begin */
64 #define S_SHELL_T      2001     /* shell command of the line */
65 #define S_NUMEXE_T     2002     /* num of entries in queues & running processes */
66 #define S_LAVG_T       2003     /* load averages needed (1, 5, 15 mins) */
67 #define S_UNTIL_T      2004     /* timeout of the wait for a lavg value */
68 #define S_NICE_T       2005     /* nice value to control priority */
69 #define S_RUNAS_T      2006     /* determine permissions of the job */
70 #define S_MAILTO_T     2007     /* mail output to cl_mailto */
71 #define S_NEXTEXE_T    2008     /* time and date of the next execution */
72 #define S_REMAIN_T     2009     /* remaining until next execution */
73 #define S_TIMEFREQ_T   2010     /* Run every n seconds */
74 #define S_RUNFREQ_T    2011     /* Run once every n matches */
75 #define S_MINS_T       2012     /* mins boolean array */
76 #define S_HRS_T        2013     /* hrs boolean array */
77 #define S_DAYS_T       2014     /* days boolean array */
78 #define S_MONS_T       2015     /* mons boolean array */
79 #define S_DOW_T        2016     /* dow boolean array */
80 #define S_OPTION_T     2017     /* options for that line (see option.h) */
81 #define S_FIRST_T      2018     /* wait time before first execution */
82 #define S_TZ_T         2019     /* time zone of the line */
83 #define S_JITTER_T     2020     /* jitter of the line */
84
85 #endif                          /* __SAVE_H__ */