{
  "created": "2015-12-20T19:56:47Z",
  "hierarchy": [
    {
      "name": "ROOT",
      "type": "folder",
      "uri": "/ROOT"
    },
    {
      "name": "Incrond",
      "type": "article",
      "uri": "Incrond"
    }
  ],
  "html": "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"/><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/><meta name=\"name\" content=\"Nikhil's Personal Wiki\"/><meta name=\"description\" content=\"Incrond – Nikhil's Personal Wiki\"/><meta name=\"author\" content=\"Nikhil Anand\"/><meta name=\"theme-color\" content=\"#ffe9a00\"/><meta property=\"og:title\" content=\"Incrond – Nikhil's Personal Wiki\"/><meta property=\"og:description\" content=\"Incrond – Nikhil's Personal Wiki\"/><meta property=\"og:type\" content=\"website\"/><meta property=\"og:image\" content=\"/img/logo512.png\"/><meta property=\"og:site_name\" content=\"Nikhil's Personal Wiki\"/><link rel=\"og:image\" href=\"/img/logo512.png\"/><link rel=\"icon\" href=\"/img/favicon.png\"/><link rel=\"apple-touch-icon\" href=\"/img/logo192.png\"/><link rel=\"stylesheet\" href=\"/css/styles.css\"/><title>Incrond – Nikhil's Personal Wiki</title><script defer data-domain=\"wiki.nikhil.io\" src=\"https://plausible.io/js/plausible.js\"></script></head><body><noscript>👉 A few things won't work if you have JavaScript disabled.</noscript><div class=\"container article\"><header><nav><ul><li><a href=\"/archive\" class title=\"Archive\"><span>Archive</span></a></li><li><a href=\"/Home\" class title=\"Home\"><span>Home</span></a></li><li><a href=\"/random\" class title=\"See a random article\"><span>Random</span></a></li><li><a href=\"/Incrond/raw.txt\" title=\"View Source\"><span>Raw</span></a></li><li><a href=\"/Incrond/revisions\" class title=\"View revisions\"><span>Revisions</span></a></li><li><a href=\"/Incrond/index.json\" title=\"View JSON Object\"><span>JSON</span></a></li></ul></nav></header><main><article><article-hierarchy><ul><li><a data-entity-type=\"folder\" href=\"/ROOT\" title=\"ROOT\">Root</a></li><li><a data-entity-type=\"article\" href=\"/Incrond\" title=\"Incrond\">Incrond</a></li></ul></article-hierarchy><header><h1>Incrond</h1></header><article-content><p><code>incron</code> is an <a href=\"http://inotify.aiken.cz/\">inotify</a>-based cron system. You can make it do stuff (like trigger a script) when files or directories change, are opened, closed, etc (i.e., &ldquo;filesystem events&rdquo;).<br />\nYou need a 2.6.13 kernel or higher to use it.</p>\n<h2 id=\"installation\">Installation</h2>\n<pre><code># CentOS/RHEL\nsudo yum install incron --yes\n\n# Ubuntu\nsudo apt-get install incron --yes\n</code></pre>\n<p>The global config file is <code>/etc/incron.conf</code>. Now make sure you start the service (might be a good idea to <code>chkconfig</code> this too):</p>\n<pre><code># CentOS/RHEL\nservice incrond start\n\n# Ubuntu\n/etc/init.d/incron start\n</code></pre>\n<h2 id=\"events\">Events</h2>\n<p>You can get a listing of events by issuing:</p>\n<pre><code>[root@example ~]# incrontab -t\nIN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,\nIN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,\nIN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF\n</code></pre>\n<p>You can find an explanation of each in <code>/usr/include/linux/inotify.h</code>. For example:</p>\n<pre><code>26 /* the following are legal, implemented events that user-space can watch for */\n27 #define IN_ACCESS               0x00000001      /* File was accessed */\n28 #define IN_MODIFY               0x00000002      /* File was modified */\n29 #define IN_ATTRIB               0x00000004      /* Metadata changed */\n30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */\n31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */\n32 #define IN_OPEN                 0x00000020      /* File was opened */\n33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */\n34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */\n35 #define IN_CREATE               0x00000100      /* Subfile was created */\n36 #define IN_DELETE               0x00000200      /* Subfile was deleted */\n37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */\n38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */\n</code></pre>\n<h2 id=\"creating-traps\">Creating traps</h2>\n<p>Start editing your incrontab with <code>incrontab *-e*</code>. Here are some examples of traps</p>\n<pre tabindex=\"0\" class=\"chroma\"><code><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># Restart the NTP daemon when its config file changes  </span>\n</span></span><span class=\"line\"><span class=\"cl\">/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart  \n</span></span><span class=\"line\"><span class=\"cl\">\n</span></span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># Run a script with the absolute path to filename as parameter when it changes (and is closed)  </span>\n</span></span><span class=\"line\"><span class=\"cl\">/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh <span class=\"nv\">$@</span>/<span class=\"nv\">$#</span>\n</span></span></code></pre><p>Here is a full list of wildcards:</p>\n<pre><code>$$ - a dollar sign\n$@ - the watched filesystem path\n$# - the event-related file name\n$% - the event flags (textually)\n$&amp; - the event flags (numerically)\n</code></pre>\n<h2 id=\"sources\">Sources</h2>\n<ul>\n<li><code>/usr/share/doc/incron/README</code> (Ubuntu)</li>\n<li><code>/usr/share/doc/incron-0.5.5/README</code> (CentOS/RHEL)</li>\n</ul>\n</article-content></article></main><footer><p></p><ul><li>3,167 bytes</li><li>Created on Sunday, 20 December 2015 at 19:56 UTC</li><li>Modified on Thursday, 28 May 2026 at 13:06 UTC</li><br/><li><a href=\"https://github.com/afreeorange/wiki.nikhil.io.articles/edit/master/Incrond.md\" title=\"Edit this article\">Edit this article</a></li><li><a href=\"https://github.com/afreeorange/bock\" title=\"View the project that generates this wiki on Github\"><span>bock 6.3.0-alpha</span></a></li></ul></footer></div><script src=\"/js/table-sort.js\" defer></script><script type=\"text/javascript\">\n        document.body.addEventListener(\n          \"keypress\", (e) => e.key === \"f\"\n          ? window.location.assign(\"/archive\")\n          : null);\n      </script></body></html>",
  "id": "15dacd6d-5ccb-5186-82d5-bad2b2279852",
  "modified": "2026-05-28T13:06:18Z",
  "revisions": [
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2026-05-28T13:06:18Z",
      "id": "e2117f28ad2ef0c42f1ff6ade254239c2661825d",
      "shortId": "e2117f28",
      "subject": "Formatting fixes -- Claude\n",
      "content": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system. You can make it do stuff (like trigger a script) when files or directories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\n## Installation\n\n    # CentOS/RHEL\n    sudo yum install incron --yes\n\n    # Ubuntu\n    sudo apt-get install incron --yes\n\nThe global config file is `/etc/incron.conf`. Now make sure you start the service (might be a good idea to `chkconfig` this too):\n\n    # CentOS/RHEL\n    service incrond start\n\n    # Ubuntu\n    /etc/init.d/incron start\n\n## Events\n\nYou can get a listing of events by issuing:\n\n    [root@example ~]# incrontab -t\n    IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,\n    IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,\n    IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`. For example:\n\n    26 /* the following are legal, implemented events that user-space can watch for */\n    27 #define IN_ACCESS               0x00000001      /* File was accessed */\n    28 #define IN_MODIFY               0x00000002      /* File was modified */\n    29 #define IN_ATTRIB               0x00000004      /* Metadata changed */\n    30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */\n    31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */\n    32 #define IN_OPEN                 0x00000020      /* File was opened */\n    33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */\n    34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */\n    35 #define IN_CREATE               0x00000100      /* Subfile was created */\n    36 #define IN_DELETE               0x00000200      /* Subfile was deleted */\n    37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */\n    38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */\n\n## Creating traps\n\nStart editing your incrontab with `incrontab *-e*`. Here are some examples of traps\n\n```bash\n# Restart the NTP daemon when its config file changes  \n/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart  \n\n# Run a script with the absolute path to filename as parameter when it changes (and is closed)  \n/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#\n```\n\nHere is a full list of wildcards:\n\n    $$ - a dollar sign\n    $@ - the watched filesystem path\n    $# - the event-related file name\n    $% - the event flags (textually)\n    $& - the event flags (numerically)\n\n## Sources\n\n-   `/usr/share/doc/incron/README` (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README` (CentOS/RHEL)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2026-01-13T18:47:28Z",
      "id": "2436477560f26e23d00a24add1cbfeafdca4af78",
      "shortId": "24364775",
      "subject": "No compression\n",
      "content": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system.\nYou can make it do stuff (like trigger a script) when files or\ndirectories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\nInstallation\n------------\n\n    # CentOS/RHEL  \n    sudo yum install incron --yes  \n  \n    # Ubuntu  \n    sudo apt-get install incron --yes\n\nThe global config file is `/etc/incron.conf`. Now make sure you start\nthe service (might be a good idea to `chkconfig` this too):\n\n    # CentOS/RHEL  \n    service incrond start  \n  \n    # Ubuntu  \n    /etc/init.d/incron start\n\nEvents\n------\n\nYou can get a listing of events by issuing:\n\n    [root@example ~]# incrontab -t  \n    IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,  \n    IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,  \n    IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`.\nFor example:\n\n    26 /* the following are legal, implemented events that user-space can watch for */  \n    27 #define IN_ACCESS               0x00000001      /* File was accessed */  \n    28 #define IN_MODIFY               0x00000002      /* File was modified */  \n    29 #define IN_ATTRIB               0x00000004      /* Metadata changed */  \n    30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */  \n    31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */  \n    32 #define IN_OPEN                 0x00000020      /* File was opened */  \n    33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */  \n    34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */  \n    35 #define IN_CREATE               0x00000100      /* Subfile was created */  \n    36 #define IN_DELETE               0x00000200      /* Subfile was deleted */  \n    37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */  \n    38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */\n\nCreating traps\n--------------\n\nStart editing your incrontab with `incrontab *-e*`. Here are some\nexamples of traps\n\n```bash\n# Restart the NTP daemon when its config file changes  \n/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart  \n\n# Run a script with the absolute path to filename as parameter when it changes (and is closed)  \n/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#\n```\n\nHere is a full list of wildcards:\n\n    $$ - a dollar sign  \n    $@ - the watched filesystem path   \n    $# - the event-related file name  \n    $% - the event flags (textually)  \n    $& - the event flags (numerically)\n\nSources\n-------\n\n-   `/usr/share/doc/incron/README` (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README` (CentOS/RHEL)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-27T07:27:56Z",
      "id": "1aa29105a45aa67523ffb61e73bcc415f935a47e",
      "shortId": "1aa29105",
      "subject": "Fix Markdown conversion\n\nSaw half a season of The Office\n",
      "content": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system.\nYou can make it do stuff (like trigger a script) when files or\ndirectories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\nInstallation\n------------\n\n    # CentOS/RHEL  \n    sudo yum install incron --yes  \n  \n    # Ubuntu  \n    sudo apt-get install incron --yes\n\nThe global config file is `/etc/incron.conf`. Now make sure you start\nthe service (might be a good idea to `chkconfig` this too):\n\n    # CentOS/RHEL  \n    service incrond start  \n  \n    # Ubuntu  \n    /etc/init.d/incron start\n\nEvents\n------\n\nYou can get a listing of events by issuing:\n\n    [root@example ~]# incrontab -t  \n    IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,  \n    IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,  \n    IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`.\nFor example:\n\n    26 /* the following are legal, implemented events that user-space can watch for */  \n    27 #define IN_ACCESS               0x00000001      /* File was accessed */  \n    28 #define IN_MODIFY               0x00000002      /* File was modified */  \n    29 #define IN_ATTRIB               0x00000004      /* Metadata changed */  \n    30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */  \n    31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */  \n    32 #define IN_OPEN                 0x00000020      /* File was opened */  \n    33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */  \n    34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */  \n    35 #define IN_CREATE               0x00000100      /* Subfile was created */  \n    36 #define IN_DELETE               0x00000200      /* Subfile was deleted */  \n    37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */  \n    38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */\n\nCreating traps\n--------------\n\nStart editing your incrontab with `incrontab *-e*`. Here are some\nexamples of traps\n\n```bash\n# Restart the NTP daemon when its config file changes  \n/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart  \n\n# Run a script with the absolute path to filename as parameter when it changes (and is closed)  \n/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#\n```\n\nHere is a full list of wildcards:\n\n    $$ - a dollar sign  \n    $@ - the watched filesystem path   \n    $# - the event-related file name  \n    $% - the event flags (textually)  \n    $& - the event flags (numerically)\n\nSources\n-------\n\n-   `/usr/share/doc/incron/README` (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README` (CentOS/RHEL)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-21T02:30:47Z",
      "id": "d658e80d1ecb97b196531c7b15a0f9af709c05de",
      "shortId": "d658e80d",
      "subject": "Incremental\n",
      "content": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system.\nYou can make it do stuff (like trigger a script) when files or\ndirectories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\nInstallation\n------------\n\n`# CentOS/RHEL`  \n`sudo yum install incron --yes`  \n  \n`# Ubuntu`  \n`sudo apt-get install incron --yes`\n\nThe global config file is `/etc/incron.conf`. Now make sure you start\nthe service (might be a good idea to `chkconfig` this too):\n\n`# CentOS/RHEL`  \n`service incrond start`  \n  \n`# Ubuntu`  \n`/etc/init.d/incron start`\n\nEvents\n------\n\nYou can get a listing of events by issuing:\n\n`[root@example ~]# incrontab `**`-t`**  \n`IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,`  \n`IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,`  \n`IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF`\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`.\nFor example:\n\n`26 /* the following are legal, implemented events that user-space can watch for */`  \n`27 #define IN_ACCESS               0x00000001      /* File was accessed */`  \n`28 #define IN_MODIFY               0x00000002      /* File was modified */`  \n`29 #define IN_ATTRIB               0x00000004      /* Metadata changed */`  \n`30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */`  \n`31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */`  \n`32 #define IN_OPEN                 0x00000020      /* File was opened */`  \n`33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */`  \n`34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */`  \n`35 #define IN_CREATE               0x00000100      /* Subfile was created */`  \n`36 #define IN_DELETE               0x00000200      /* Subfile was deleted */`  \n`37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */`  \n`38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */`\n\nCreating traps\n--------------\n\nStart editing your incrontab with `incrontab '''-e'''`. Here are some\nexamples of traps\n\n`# Restart the NTP daemon when its config file changes`  \n`/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart`  \n  \n`# Run a script with the absolute path to filename as parameter when it changes (and is closed)`  \n`/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#`\n\nHere is a full list of wildcards:\n\n`$$ - a dollar sign`  \n`$@ - the watched filesystem path `  \n`$# - the event-related file name`  \n`$% - the event flags (textually)`  \n`$& - the event flags (numerically)`\n\nSources\n-------\n\n-   `/usr/share/doc/incron/README`  \n    (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README`  \n    (CentOS/RHEL)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-20T19:56:47Z",
      "id": "569c621e85b6f5d7a9730d97ef9818eda29ffa1a",
      "shortId": "569c621e",
      "subject": "Incrond : First Draft\n",
      "content": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system.\nYou can make it do stuff (like trigger a script) when files or\ndirectories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\nInstallation\n------------\n\n`# CentOS/RHEL`  \n`sudo yum install incron --yes`  \n  \n`# Ubuntu`  \n`sudo apt-get install incron --yes`\n\nThe global config file is `/etc/incron.conf`. Now make sure you start\nthe service (might be a good idea to `chkconfig` this too):\n\n`# CentOS/RHEL`  \n`service incrond start`  \n  \n`# Ubuntu`  \n`/etc/init.d/incron start`\n\nEvents\n------\n\nYou can get a listing of events by issuing:\n\n`[root@example ~]# incrontab `**`-t`**  \n`IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,`  \n`IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,`  \n`IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF`\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`.\nFor example:\n\n`26 /* the following are legal, implemented events that user-space can watch for */`  \n`27 #define IN_ACCESS               0x00000001      /* File was accessed */`  \n`28 #define IN_MODIFY               0x00000002      /* File was modified */`  \n`29 #define IN_ATTRIB               0x00000004      /* Metadata changed */`  \n`30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */`  \n`31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */`  \n`32 #define IN_OPEN                 0x00000020      /* File was opened */`  \n`33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */`  \n`34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */`  \n`35 #define IN_CREATE               0x00000100      /* Subfile was created */`  \n`36 #define IN_DELETE               0x00000200      /* Subfile was deleted */`  \n`37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */`  \n`38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */`\n\nCreating traps\n--------------\n\nStart editing your incrontab with `incrontab '''-e'''`. Here are some\nexamples of traps\n\n`# Restart the NTP daemon when its config file changes`  \n`/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart`  \n  \n`# Run a script with the absolute path to filename as parameter when it changes (and is closed)`  \n`/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#`\n\nHere is a full list of wildcards:\n\n`$$ - a dollar sign`  \n`$@ - the watched filesystem path `  \n`$# - the event-related file name`  \n`$% - the event flags (textually)`  \n`$& - the event flags (numerically)`\n\nSources\n-------\n\n-   `/usr/share/doc/incron/README`  \n    (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README`  \n    (CentOS/RHEL)\n\n[Category:Nikhil's Notes](Category:Nikhil's_Notes \"wikilink\")\n[Category:From a past sysadmin\nlife](Category:From_a_past_sysadmin_life \"wikilink\")\n"
    }
  ],
  "sizeInBytes": 3167,
  "source": "`incron` is an [inotify](http://inotify.aiken.cz/)-based cron system. You can make it do stuff (like trigger a script) when files or directories change, are opened, closed, etc (i.e., \"filesystem events\").\nYou need a 2.6.13 kernel or higher to use it.\n\n## Installation\n\n    # CentOS/RHEL\n    sudo yum install incron --yes\n\n    # Ubuntu\n    sudo apt-get install incron --yes\n\nThe global config file is `/etc/incron.conf`. Now make sure you start the service (might be a good idea to `chkconfig` this too):\n\n    # CentOS/RHEL\n    service incrond start\n\n    # Ubuntu\n    /etc/init.d/incron start\n\n## Events\n\nYou can get a listing of events by issuing:\n\n    [root@example ~]# incrontab -t\n    IN_ACCESS,IN_MODIFY,IN_ATTRIB,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE,IN_OPEN,\n    IN_MOVED_FROM,IN_MOVED_TO,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_CLOSE,\n    IN_MOVE,IN_ONESHOT,IN_ALL_EVENTS,IN_DONT_FOLLOW,IN_ONLYDIR,IN_MOVE_SELF\n\nYou can find an explanation of each in `/usr/include/linux/inotify.h`. For example:\n\n    26 /* the following are legal, implemented events that user-space can watch for */\n    27 #define IN_ACCESS               0x00000001      /* File was accessed */\n    28 #define IN_MODIFY               0x00000002      /* File was modified */\n    29 #define IN_ATTRIB               0x00000004      /* Metadata changed */\n    30 #define IN_CLOSE_WRITE          0x00000008      /* Writtable file was closed */\n    31 #define IN_CLOSE_NOWRITE        0x00000010      /* Unwrittable file closed */\n    32 #define IN_OPEN                 0x00000020      /* File was opened */\n    33 #define IN_MOVED_FROM           0x00000040      /* File was moved from X */\n    34 #define IN_MOVED_TO             0x00000080      /* File was moved to Y */\n    35 #define IN_CREATE               0x00000100      /* Subfile was created */\n    36 #define IN_DELETE               0x00000200      /* Subfile was deleted */\n    37 #define IN_DELETE_SELF          0x00000400      /* Self was deleted */\n    38 #define IN_MOVE_SELF            0x00000800      /* Self was moved */\n\n## Creating traps\n\nStart editing your incrontab with `incrontab *-e*`. Here are some examples of traps\n\n```bash\n# Restart the NTP daemon when its config file changes  \n/etc/ntp/ntp.conf IN_MODIFY /sbin/service ntpd restart  \n\n# Run a script with the absolute path to filename as parameter when it changes (and is closed)  \n/home/nanand/thesis.txt IN_WRITE_CLOSE /home/nanand/bin/log_changes.sh $@/$#\n```\n\nHere is a full list of wildcards:\n\n    $$ - a dollar sign\n    $@ - the watched filesystem path\n    $# - the event-related file name\n    $% - the event flags (textually)\n    $& - the event flags (numerically)\n\n## Sources\n\n-   `/usr/share/doc/incron/README` (Ubuntu)\n-   `/usr/share/doc/incron-0.5.5/README` (CentOS/RHEL)\n",
  "title": "Incrond",
  "untracked": false,
  "uri": "/Incrond",
  "relativePath": "Incrond.md"
}
