{"id":13513,"date":"2019-08-16T02:44:11","date_gmt":"2019-08-16T00:44:11","guid":{"rendered":"http:\/\/blog.wenzlaff.de\/?p=13513"},"modified":"2019-08-15T17:57:39","modified_gmt":"2019-08-15T15:57:39","slug":"raspberry-pi-veraenderungen-an-dateien-oder-verzeichnissen-mit-inotify-ueberwachen","status":"publish","type":"post","link":"http:\/\/blog.wenzlaff.de\/?p=13513","title":{"rendered":"Raspberry Pi:  Ver\u00e4nderungen an Dateien oder Verzeichnissen mit inotify \u00fcberwachen"},"content":{"rendered":"<p>Auch auf dem Raspberry Pi k\u00f6nnen leicht Verzeichnisse oder Dateien \u00fcberwacht werden. Dazu muss einmalig die <strong>inotify-tools<\/strong> mit<\/p>\n<p><strong>sudo apt-get install inotify-tools<\/strong><\/p>\n<p>installiert werden.<br \/>\n<a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019.jpg\" alt=\"\" width=\"2732\" height=\"2048\" class=\"aligncenter size-full wp-image-13520\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019.jpg 2732w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019-300x225.jpg 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019-768x576.jpg 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Die-liebe-versagt-nie-2019-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><br \/>\nDas geht ohne neustart und ist in 3 Minuten erledigt. Schon kann dann z.B. mit<\/p>\n<p><strong>inotifywait -mrq -e create &#8211;format %w%f \/home\/pi<\/strong><\/p>\n<p>das <strong>\/home\/pi<\/strong> Verzeichnis \u00fcberwacht werden. Nach dem Start k\u00f6nnen wir in einem anderen Terminal Fenster eine Datei oder zwei anlegen:<!--more--><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.48.00.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.48.00.png\" alt=\"\" width=\"618\" height=\"62\" class=\"aligncenter size-full wp-image-13514\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.48.00.png 618w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.48.00-300x30.png 300w\" sizes=\"auto, (max-width: 618px) 100vw, 618px\" \/><\/a><\/p>\n<p>Und schon wird die neu angelegte Datei ausgegeben:<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.47.49.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.47.49.png\" alt=\"\" width=\"728\" height=\"79\" class=\"aligncenter size-full wp-image-13515\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.47.49.png 728w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2019\/08\/Bildschirmfoto-2019-08-15-um-17.47.49-300x33.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/a><\/p>\n<p>Weitere infos werden mit -h ausgegeben:<\/p>\n<pre class=\"lang:default decode:true \" >inotifywait -h\r\ninotifywait 3.14\r\nWait for a particular event on a file or set of files.\r\nUsage: inotifywait [ options ] file1 [ file2 ] [ file3 ] [ ... ]\r\nOptions:\r\n\t-h|--help     \tShow this help text.\r\n\t@&lt;file&gt;       \tExclude the specified file from being watched.\r\n\t--exclude &lt;pattern&gt;\r\n\t              \tExclude all events on files matching the\r\n\t              \textended regular expression &lt;pattern&gt;.\r\n\t--excludei &lt;pattern&gt;\r\n\t              \tLike --exclude but case insensitive.\r\n\t-m|--monitor  \tKeep listening for events forever.  Without\r\n\t              \tthis option, inotifywait will exit after one\r\n\t              \tevent is received.\r\n\t-d|--daemon   \tSame as --monitor, except run in the background\r\n\t              \tlogging events to a file specified by --outfile.\r\n\t              \tImplies --syslog.\r\n\t-r|--recursive\tWatch directories recursively.\r\n\t--fromfile &lt;file&gt;\r\n\t              \tRead files to watch from &lt;file&gt; or `-' for stdin.\r\n\t-o|--outfile &lt;file&gt;\r\n\t              \tPrint events to &lt;file&gt; rather than stdout.\r\n\t-s|--syslog   \tSend errors to syslog rather than stderr.\r\n\t-q|--quiet    \tPrint less (only print events).\r\n\t-qq           \tPrint nothing (not even events).\r\n\t--format &lt;fmt&gt;\tPrint using a specified printf-like format\r\n\t              \tstring; read the man page for more details.\r\n\t--timefmt &lt;fmt&gt;\tstrftime-compatible format string for use with\r\n\t              \t%T in --format string.\r\n\t-c|--csv      \tPrint events in CSV format.\r\n\t-t|--timeout &lt;seconds&gt;\r\n\t              \tWhen listening for a single event, time out after\r\n\t              \twaiting for an event for &lt;seconds&gt; seconds.\r\n\t              \tIf &lt;seconds&gt; is 0, inotifywait will never time out.\r\n\t-e|--event &lt;event1&gt; [ -e|--event &lt;event2&gt; ... ]\r\n\t\tListen for specific event(s).  If omitted, all events are \r\n\t\tlistened for.\r\n\r\nExit status:\r\n\t0  -  An event you asked to watch for was received.\r\n\t1  -  An event you did not ask to watch for was received\r\n\t      (usually delete_self or unmount), or some error occurred.\r\n\t2  -  The --timeout option was given and no events occurred\r\n\t      in the specified interval of time.\r\n\r\nEvents:\r\n\taccess\t\tfile or directory contents were read\r\n\tmodify\t\tfile or directory contents were written\r\n\tattrib\t\tfile or directory attributes changed\r\n\tclose_write\tfile or directory closed, after being opened in\r\n\t           \twritable mode\r\n\tclose_nowrite\tfile or directory closed, after being opened in\r\n\t           \tread-only mode\r\n\tclose\t\tfile or directory closed, regardless of read\/write mode\r\n\topen\t\tfile or directory opened\r\n\tmoved_to\tfile or directory moved to watched directory\r\n\tmoved_from\tfile or directory moved from watched directory\r\n\tmove\t\tfile or directory moved to or from watched directory\r\n\tcreate\t\tfile or directory created within watched directory\r\n\tdelete\t\tfile or directory deleted within watched directory\r\n\tdelete_self\tfile or directory was deleted\r\n\tunmount\t\tfile system containing file or directory unmounted\r\n<\/pre>\n<p>oder auch auf der <a href=\"https:\/\/wiki.ubuntuusers.de\/inotify\/\" rel=\"noopener noreferrer\" target=\"_blank\">inotify<\/a> Seite.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Auch auf dem Raspberry Pi k\u00f6nnen leicht Verzeichnisse oder Dateien \u00fcberwacht werden. Dazu muss einmalig die inotify-tools mit sudo apt-get install inotify-tools installiert werden. Das geht ohne neustart und ist in 3 Minuten erledigt. Schon kann dann z.B. mit inotifywait -mrq -e create &#8211;format %w%f \/home\/pi das \/home\/pi Verzeichnis \u00fcberwacht werden. Nach dem Start k\u00f6nnen &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/blog.wenzlaff.de\/?p=13513\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eRaspberry Pi:  Ver\u00e4nderungen an Dateien oder Verzeichnissen mit inotify \u00fcberwachen\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[220,2173,566,2172,808,1023,2752,3336],"tags":[3734,1025,2190],"class_list":["post-13513","post","type-post","status-publish","format-standard","hentry","category-anleitung","category-debian","category-hardware","category-kali-linux-2","category-linux-2","category-raspberry-pi","category-raspberry-pi-zero-w","category-ubuntu","tag-inotify","tag-pi","tag-raspberry-pi"],"_links":{"self":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/13513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13513"}],"version-history":[{"count":0,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/13513\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13513"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}