Subversion Repositories public

Rev

Rev 45 | Rev 55 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45 Rev 47
1
inotify cron system
1
inotify cron system
2
2
3
(c) Lukas Jelinek, 2006
3
(c) Lukas Jelinek, 2006
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
2. Requirements
22
2. Requirements
23
* Linux kernel 2.6.13 or later (with inotify compiled in)
23
* Linux kernel 2.6.13 or later (with inotify compiled in)
24
* inotify headers (inotify.h, inotify-syscalls.h) installed in
24
* inotify headers (inotify.h, inotify-syscalls.h) installed in
25
  <INCLUDE_DIR>/sys. The most common place is /usr/include/sys.
25
  <INCLUDE_DIR>/sys. The most common place is /usr/include/sys.
26
* GCC 4.x compiler (probably works also with GCC 3.4, possibly with
26
* GCC 4.x compiler (probably works also with GCC 3.4, possibly with
27
  older versions too)
27
  older versions too)
28
28
29
  
29
  
30
3. How to build
30
3. How to build
31
Because this version is very early it does not contain a standard
31
Because this version is very early it does not contain a standard
32
portable build mechanism. There is only a Makefile which must be
32
portable build mechanism. There is only a Makefile which must be
33
modified manually. On many Linux systems you need not to change
33
modified manually. On many Linux systems you need not to change
34
anything.
34
anything.
35
35
36
Please review the Makefile BEFORE you type 'make'. Especially
36
Please review the Makefile BEFORE you type 'make'. Especially
37
check the PREFIX and other common variables. If done you can
37
check the PREFIX and other common variables. If done you can
38
now build the files ('make').
38
now build the files ('make').
39
39
40
The binaries must be of course installed as root. Note that the
40
The binaries must be of course installed as root. Note that the
41
installer creates a special user called 'incron' which manages
41
installer creates a special user called 'incron' which manages
42
the incron tables.
42
the incron tables.
43
43
44
44
45
4. How to use
45
4. How to use
46
The incron daemon (incrond) must be run under root (typically from
46
The incron daemon (incrond) must be run under root (typically from
47
runlevel script etc.). It loads the current user tables and hooks
47
runlevel script etc.). It loads the current user tables and hooks
48
them for later changes.
48
them for later changes.
49
49
50
The incron table manipulator may be run under any regular user
50
The incron table manipulator may be run under any regular user
51
since it SUIDs. For manipulation with the tables use basically
51
since it SUIDs. For manipulation with the tables use basically
52
the same syntax as for the crontab program. You can import a table,
52
the same syntax as for the crontab program. You can import a table,
53
remove and edit the current table.
53
remove and edit the current table.
54
54
55
The user table rows have the following syntax:
55
The user table rows have the following syntax:
56
 <path> <mask> <command>
56
 <path> <mask> <command>
57
57
58
Where:
58
Where:
59
59
60
  <path> is a filesystem path (currently avoid whitespaces!)
60
  <path> is a filesystem path (currently avoid whitespaces!)
61
  <mask> is a symbolic (see inotify.h; use commas for separating
61
  <mask> is a symbolic (see inotify.h; use commas for separating
62
         symbols) or numeric mask for events
62
         symbols) or numeric mask for events
63
  <command> is an application or script to run on the events
63
  <command> is an application or script to run on the events
64
64
65
The command may contain these wildcards:
65
The command may contain these wildcards:
66
66
67
  $$ - a dollar sign
67
  $$ - a dollar sign
68
  $@ - the watched filesystem path (see above)
68
  $@ - the watched filesystem path (see above)
69
  $# - the event-related file name
69
  $# - the event-related file name
70
70
71
Example: You need to run program 'abc' with the full file path as
71
The mask may additionaly contain a special symbol IN_NO_LOOP which
-
 
72
disables events occurred during the event handling (to avoid loops).
-
 
73
-
 
74
Example: You need to run program 'abc' with the full file path as
72
an argument every time a file is changed in /var/mail. One of
75
an argument every time a file is changed in /var/mail. One of
73
the solutions follows:
76
the solutions follows:
74
77
75
/var/mail IN_CLOSE_WRITE abc $@/$#
78
/var/mail IN_CLOSE_WRITE abc $@/$#
76
79
77
80
78
5. Bugs, suggestions
81
5. Bugs, suggestions
79
THIS PROGRAM IS AN ALPHA VERSION. IT PROBABLY CONTAINS BUGS AND
82
THIS PROGRAM IS AN ALPHA VERSION. IT PROBABLY CONTAINS BUGS AND
80
THEREFORE IT IS NOT INTENDED FOR PRODUCTION USE.
83
THEREFORE IT IS NOT INTENDED FOR PRODUCTION USE.
81
84
82
If you find a bug or have a suggestion how to improve the program,
85
If you find a bug or have a suggestion how to improve the program,
83
please use the bug tracking system at http://bts.aiken.cz.
86
please use the bug tracking system at http://bts.aiken.cz.
84
87
85
88
86
6. Licensing
89
6. Licensing
87
This program is free software; you can redistribute it and/or
90
This program is free software; you can redistribute it and/or
88
modify it under the terms of the GNU General Public License,
91
modify it under the terms of the GNU General Public License,
89
version 2  (see LICENSE-GPL).
92
version 2  (see LICENSE-GPL).
90
93
91
Some parts may be also licensed covere by other licenses.
94
Some parts may be also licensed covere by other licenses.
92
Please look into the source files for detailed information.
95
Please look into the source files for detailed information.