Subversion Repositories public

Rev

Rev 102 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 102 Rev 108
1
inotify cron system
1
inotify cron system
2
2
3
(c) Lukas Jelinek, 2006, 2007, 2008, 2009
3
(c) Lukas Jelinek, 2006, 2007, 2008, 2009, 2012
4
4
5
1. About
5
1. About
6
2. Requirements
6
2. Requirements
7
3. How to use
7
3. How to use
8
4. Bugs, suggestions
8
4. Bugs, suggestions
9
5. Licensing
9
5. Licensing
10
6. Documentation
10
6. Documentation
11
11
12
12
13
========================================================================
13
========================================================================
14
14
15
15
16
1. About
16
1. About
17
This program is the "inotify cron" system. It consist of a daemon and
17
This program is the "inotify cron" system. It consist of a daemon and
18
a table manipulator. You can use it a similar way as the regular cron.
18
a table manipulator. You can use it a similar way as the regular cron.
19
The difference is that the inotify cron handles filesystem events
19
The difference is that the inotify cron handles filesystem events
20
rather than time periods.
20
rather than time periods.
21
21
22
22
23
2. Requirements
23
2. Requirements
24
* Linux kernel 2.6.13 or later (with inotify compiled in)
24
* Linux kernel 2.6.13 or later (with inotify compiled in)
25
* inotify headers (inotify.h, sometimes inotify-syscalls.h) installed in
25
* inotify headers (inotify.h, sometimes inotify-syscalls.h) installed in
26
  <INCLUDE_DIR>/sys. The most common place is /usr/include/sys.
26
  <INCLUDE_DIR>/sys. The most common place is /usr/include/sys.
27
* GCC 4.x compiler (probably works also with GCC 3.4, possibly with
27
* GCC 4.x compiler (probably works also with GCC 3.4, possibly with
28
  older versions too)
28
  older versions too)
29
29
30
  
30
  
31
3. How to build
31
3. How to build
32
Because this version is very early it does not contain a standard
32
Because this version is very early it does not contain a standard
33
portable build mechanism. There is only a Makefile which must be
33
portable build mechanism. There is only a Makefile which must be
34
modified manually. On many Linux systems you need not to change
34
modified manually. On many Linux systems you need not to change
35
anything.
35
anything.
36
36
37
Please review the Makefile BEFORE you type 'make'. Especially
37
Please review the Makefile BEFORE you type 'make'. Especially
38
check the PREFIX and other common variables. If done you can
38
check the PREFIX and other common variables. If done you can
39
now build the files ('make').
39
now build the files ('make').
40
40
41
The binaries must be of course installed as root.
41
The binaries must be of course installed as root.
42
42
43
If you want to use (after editting) the example configuration
43
If you want to use (after editing) the example configuration
44
file simply rename it from /etc/incron.conf.example to
44
file simply rename it from /etc/incron.conf.example to
45
/etc/incron.conf (you can also use -f <config> for one-time
45
/etc/incron.conf (you can also use -f <config> for one-time
46
use of a custom configuration file).
46
use of a custom configuration file).
47
47
48
Making a release of the source tree relies on the 'VERSION' file.
48
Making a release of the source tree relies on the 'VERSION' file.
49
The file should contain only a simple version string such as '0.5.9'
49
The file should contain only a simple version string such as '0.5.9'
50
or (if you wish) something more comlex (e.g. '0.5.9-improved').
50
or (if you wish) something more comlex (e.g. '0.5.9-improved').
51
The doxygen program must be installed and its control file 'Doxygen'
51
The doxygen program must be installed and its control file 'Doxygen'
52
created for generating the API documentation.
52
created for generating the API documentation.
53
53
54
54
55
4. How to use
55
4. How to use
56
The incron daemon (incrond) must be run under root (typically from
56
The incron daemon (incrond) must be run under root (typically from
57
runlevel script etc.). It loads the current user tables and hooks
57
runlevel script etc.). It loads the current user tables and hooks
58
them for later changes.
58
them for later changes.
59
59
60
The incron table manipulator may be run under any regular user
60
The incron table manipulator may be run under any regular user
61
since it SUIDs. For manipulation with the tables use basically
61
since it SUIDs. For manipulation with the tables use basically
62
the same syntax as for the crontab program. You can import a table,
62
the same syntax as for the crontab program. You can import a table,
63
remove and edit the current table.
63
remove and edit the current table.
64
64
65
The user table rows have the following syntax:
65
The user table rows have the following syntax:
66
 <path> <mask> <command>
66
 <path> <mask> <command>
67
67
68
Where:
68
Where:
69
69
70
  <path> is a filesystem path (currently avoid whitespaces!)
70
  <path> is a filesystem path (currently avoid whitespaces!)
71
  <mask> is a symbolic (see inotify.h; use commas for separating
71
  <mask> is a symbolic (see inotify.h; use commas for separating
72
         symbols) or numeric mask for events
72
         symbols) or numeric mask for events
73
  <command> is an application or script to run on the events
73
  <command> is an application or script to run on the events
74
74
75
The command may contain these wildcards:
75
The command may contain these wildcards:
76
76
77
  $$ - a dollar sign
77
  $$ - a dollar sign
78
  $@ - the watched filesystem path (see above)
78
  $@ - the watched filesystem path (see above)
79
  $# - the event-related file name
79
  $# - the event-related file name
80
  $% - the event flags (textually)
80
  $% - the event flags (textually)
81
  $& - the event flags (numerically)
81
  $& - the event flags (numerically)
82
82
83
The mask may additionaly contain a special symbol IN_NO_LOOP which
83
The mask may additionaly contain a special symbol IN_NO_LOOP which
84
disables events occurred during the event handling (to avoid loops).
84
disables events occurred during the event handling (to avoid loops).
85
85
86
Example 1: You need to run program 'abc' with the full file path as
86
Example 1: You need to run program 'abc' with the full file path as
87
an argument every time a file is changed in /var/mail. One of
87
an argument every time a file is changed in /var/mail. One of
88
the solutions follows:
88
the solutions follows:
89
89
90
/var/mail IN_CLOSE_WRITE abc $@/$#
90
/var/mail IN_CLOSE_WRITE abc $@/$#
91
91
92
Example 2: You need to run program 'efg' with the full file path as
92
Example 2: You need to run program 'efg' with the full file path as
93
the first argument and the numeric event flags as the second one.
93
the first argument and the numeric event flags as the second one.
94
It have to monitor all events on files in /tmp. Here is it:
94
It have to monitor all events on files in /tmp. Here is it:
95
95
96
/tmp IN_ALL_EVENTS efg $@/$# $&
96
/tmp IN_ALL_EVENTS efg $@/$# $&
97
97
98
Since 0.4.0 also system tables are supported. They are located in
98
Since 0.4.0 also system tables are supported. They are located in
99
/etc/incron.d and their commands use root privileges. System tables
99
/etc/incron.d and their commands use root privileges. System tables
100
are intended to be changed directly (without incrontab).
100
are intended to be changed directly (without incrontab).
101
101
102
Some parameters of both incrontab and incrond can be changed by
102
Some parameters of both incrontab and incrond can be changed by
103
the configuration. See the example file for more information.
103
the configuration. See the example file for more information.
104
104
105
105
106
5. Bugs, suggestions
106
5. Bugs, suggestions
107
THIS PROGRAM IS AN ALPHA VERSION. IT PROBABLY CONTAINS BUGS AND
107
THIS PROGRAM IS AN ALPHA VERSION. IT PROBABLY CONTAINS BUGS AND
108
THEREFORE IT IS NOT INTENDED FOR PRODUCTION USE.
108
THEREFORE IT IS NOT INTENDED FOR PRODUCTION USE.
109
109
110
If you find a bug or have a suggestion how to improve the program,
110
If you find a bug or have a suggestion how to improve the program,
111
please use the bug tracking system at http://bts.aiken.cz.
111
please use the bug tracking system at http://bts.aiken.cz.
112
112
113
113
114
6. Licensing
114
6. Licensing
115
This program is free software; you can redistribute it and/or
115
This program is free software; you can redistribute it and/or
116
modify it under the terms of the GNU General Public License,
116
modify it under the terms of the GNU General Public License,
117
version 2  (see LICENSE-GPL).
117
version 2  (see LICENSE-GPL).
118
118
119
Some parts may be also covered by other licenses.
119
Some parts may be also covered by other licenses.
120
Please look into the source files for detailed information.
120
Please look into the source files for detailed information.