--Apple-Mail-BEB31586-0255-4079-9939-ECFF018D7E09
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cet article de janvier 2022 apporte des réponses sur la limite et la récursivité :
https://www.baeldung.com/linux/inotify-upper-limit-reached
inotifywatch --recursive
« Here, the system allows 524288 (2^19) watches. »
« Because each watch is a structure, available memory is also a bottleneck for using inotify. In fact, a watch can take up to 1KB of space. This means a million watches could result in 1GB of extra RAM usage. »
5.2. inotify Watch Limit
Consider that a recursive inotifywatch on / would take up as many watches as there are files. Indeed, doing that on a filesystem with more files than the watch limit would produce an error:
etc.
Avez-vous une expérience avec la récursivité et les limites que cela peut engendrer avec les limites ?
Début du message transféré :
De: NoSpam <[email protected]>
Date: 12 janvier 2023 à 16:01:21 UTC+1
À: [email protected]
Objet: Rép. : Détecter un changement dans un répertoire
Répondre à: [email protected]d
Bonjour
Le 12/01/2023 à 15:57, [email protected] a écrit :
Bonjour,
et encore bonne année à tous,
Je cherche à surveiller ce qui se passe dans un répertoire.
Il semble exister plusieurs solutions.
La plus basique consiste à examiner les fichiers déposés, par exemple toutes les minutes (via cron ou avec un programme qui tourne en boucle et se met en pause 1 mn après chaque boucle).
Je suis plus intéressé par une programmation événementielle où le programme réagit si de nouveaux fichiers sont déposés ou modifiés et détectés par le système.
Pour faire ça, j'avais examiné inotify mais constaté qu'il y aurait des limitations (de mémoire, par exemple, sur le nombre de fichiers traitables, de inode, etc.).
J'ai repéré notamment : auditd, fswatch, inotify/inotifywait.
Selon vous, pour traiter ce besoin quelle est la solution _FIABLE_ ? (cad qui ne provoque pas d'effets de bord... ou de surprise)
Par ailleurs, pour traiter le cas où des fichiers dépendants les uns des autres sont déposés en vrac, il serait intéressant de pouvoir disposer d'un historique détaillé par fichier, exploitable.
Je suppose que ça doit être prévu (inotify le fait).
incron fait cela à la perfection
--Apple-Mail-BEB31586-0255-4079-9939-ECFF018D7E09
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div dir="ltr"></div><div dir="ltr">Cet article de janvier 2022
apporte des réponses sur la limite et la récursivité :</div><div dir="ltr"><div dir="ltr"><a href="
https://www.baeldung.com/linux/inotify-upper-limit-reached">https://www.baeldung.com/linux/inotify-upper-limit-reached</a></div><div dir="ltr"><br></div>
<div dir="ltr"><span style="font-family: "Source Code Pro", Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; white-space: pre-wrap; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -
webkit-text-size-adjust: 100%; background-color: rgb(250, 250, 250);">inotifywatch --recursive</span></div><div dir="ltr"><span style="font-family: "Source Code Pro", Consolas, "Bitstream Vera Sans Mono", "Courier New",
Courier, monospace; font-size: 14px; white-space: pre-wrap; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-color: rgb(250, 250, 250);"><br></span></div><div dir="ltr"></div><div dir="ltr">« <span style="
font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-color: rgb(255, 255, 255);">Here, the system allows </span><em style="box-sizing: border-box; font-family:
Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%;">524288</em><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-
size-adjust: 100%; background-color: rgb(255, 255, 255);"> (2^19) watches. »</span></div><div dir="ltr"><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%;
background-color: rgb(255, 255, 255);"><br></span></div><div dir="ltr"><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-color: rgb(255, 255, 255);">«
</span><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-color: rgb(255, 255, 255);">Because each watch is a structure, </span><strong
style="box-sizing: border-box; font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%;">available memory is also a bottleneck for using <em style="box-sizing: border-box;">
inotify</em></strong><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-color: rgb(255, 255, 255);">. In fact, a watch can take up to 1KB of space.
This means a million watches could result in 1GB of extra RAM usage. »</span></div><div dir="ltr"><span style="font-family: Raleway, sans-serif; font-size: 18px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; background-
color: rgb(255, 255, 255);"><br></span></div><div dir="ltr"><h3 id="bd-2-inotify-watch-limit" data-id="2-inotify-watch-limit" style="font-family: inherit; -webkit-text-size-adjust: auto; box-sizing: border-box; position: relative; line-height: 1.1;
margin-top: 2.1em; margin-bottom: 1.3em; font-size: 24px;">5.2. <em style="box-sizing: border-box;">inotify</em> Watch Limit</h3><pre class="hljs-copy-wrapper" style="font-size: 1em; -webkit-text-size-adjust: auto; box-sizing: border-box; font-
family: monospace, monospace; position: relative; overflow: hidden; word-wrap: break-word; --hljs-theme-background: rgb(250, 250, 250);"><p style="white-space: normal; box-sizing: border-box; margin: 0px 0px 10px; line-height: 1.334;">Consider that <
strong style="box-sizing: border-box;">a recursive <em style="box-sizing: border-box;">inotifywatch </em>on <em style="box-sizing: border-box;">/</em> would take up as many watches as there are files</strong>. Indeed, doing that on a
filesystem with more files than the watch limit would produce an error:</p><p style="white-space: normal; box-sizing: border-box; margin: 0px 0px 10px; line-height: 1.334;"><br></p><p style="white-space: normal; box-sizing: border-box; margin: 0px 0px
10px; line-height: 1.334;">etc.</p></pre></div><div dir="ltr">Avez-vous une expérience avec la récursivité et les limites que cela peut engendrer avec les limites ?</div><br>Début du message transféré :<br><br></div><blockquote type="cite"><
div dir="ltr"><b>De:</b> NoSpam <
[email protected]><br><b>Date:</b> 12 janvier 2023 à 16:01:21 UTC+1<br><b>À:</b>
[email protected]<br><b>Objet:</b> <b>Rép. : Détecter un changement dans un répertoire</b><br><b>Ré
pondre à:</b>
[email protected]d<br><br></div></blockquote><blockquote type="cite"><div dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Bonjour<br>
</p>
<div class="moz-cite-prefix">Le 12/01/2023 à 15:57,
<a class="moz-txt-link-abbreviated" href="mailto:
[email protected]">
[email protected]</a> a écrit :<br>
</div>
<blockquote type="cite" cite="mid:
[email protected]">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div style="font-family: arial, helvetica, sans-serif; font-size:
12pt; color: #000000">
<div>Bonjour,</div>
<div>et encore bonne année à tous,<br>
<br>
Je cherche à surveiller ce qui se passe dans un répertoire. </div>
<div><br>
Il semble exister plusieurs solutions.<br>
La plus basique consiste à examiner les fichiers déposés, par
exemple toutes les minutes (via cron ou avec un programme qui
tourne en boucle et se met en pause 1 mn après chaque boucle).<br>
Je suis plus intéressé par une programmation événementielle où
le programme réagit si de nouveaux fichiers sont déposés ou
modifiés et détectés par le système.<br>
Pour faire ça, j'avais examiné inotify mais constaté qu'il y
aurait des limitations (de mémoire, par exemple, sur le nombre
de fichiers traitables, de inode, etc.).<br>
<br>
J'ai repéré notamment : auditd, fswatch, inotify/inotifywait.<br>
<br>
Selon vous, pour traiter ce besoin quelle est la solution <strong>_FIABLE_</strong>
? (cad qui ne provoque pas d'effets de bord... ou de surprise)<br>
<br>
Par ailleurs, pour traiter le cas où des fichiers dépendants
les uns des autres sont déposés en vrac, il serait intéressant
de pouvoir disposer d'un historique détaillé par fichier,
exploitable.<br>
Je suppose que ça doit être prévu (inotify le fait).<br>
</div>
</div>
</blockquote>
incron fait cela à la perfection<br>
</div></blockquote></div></body></html> --Apple-Mail-BEB31586-0255-4079-9939-ECFF018D7E09--
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)