If you really want it to ignore those errors, open up main.c and change the "die" statement on line 475 to something else:
wd = inotify_add_watch(INOTIFY_INSTANCE, path, EVENTS);
if (wd == -1)
{
die("error: failed to add watch (%s)", path);
}
For example:
wd = inotify_add_watch(INOTIFY_INSTANCE, path, EVENTS);
if (wd == -1)
{
fprintf(stderr, "error: failed to add watch (%s)", path);
}
As there is 20Gb available on the drive, it took me a while to figure out what was going on - until I found this forum.
Admittedly, the location that it is happening on is not a frequently modified directory, so I can use the crontab solution. But I suppose for ease of use it would be nice if this error didn't come up at all.
My error is as follows:
Oct 02 20:02:36 server autochown[29803]: error: failed to add watch (/home/***/***/arcade/Video Games/***/***/***/dlc/03_character/battle/hud/SPA/RIC) [No space left on device]
(I have edited some of the directory structure as I don't want the exact names available to the world... but have left "***" in place so that the whole line is there.)
I will remove this particular directory structure from the autochown config file, but it would be great if this was added into the program so it is easy to implement.
Kind Regards, Pinball-Fixer
]]>You could create a cronjob to run "autochown -e ..." periodically on large directory hierarchies if you do not need real-time modifications. The "-e" option skips the watchlist entirely so the size limitation is lifted.* In your case you could do both, with one input file to watch the active directories and another to create a cronjob for the rest.
I've just tested -e switch on other machine with larger directory tree, works without a hitch. Thanks.
I don't mind having it executed less often as long as I won't have to chown and chmod every new file I add to any of those subprojects manually - simply because I often forget to update ownership and later waste my time finding the culprit of failing file operations.
Thanks for the explanation, I'll stick to watching most important projects then.
You could create a cronjob to run "autochown -e ..." periodically on large directory hierarchies if you do not need real-time modifications. The "-e" option skips the watchlist entirely so the size limitation is lifted.* In your case you could do both, with one input file to watch the active directories and another to create a cronjob for the rest.
* There may be a recursion limit due to directory depth. I don't remember how I implemented that right now, but if someone reaches that limit in a real-world scenario then I will try to refactor the code (if I haven't done so already).
]]>inotify_add_watch returns ENOSPC when, to quote the manpage: "The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource.". You can modify this value by writing to /proc/sys/fs/inotify/max_user_watches, but there is a hard limit, and every watch consumes kernel resources.
Thanks for the explanation, I'll stick to watching most important projects then.
]]>I'm trying to set up autochown to monitor user permissions in apache's webroot. Right now I'm stuck with following error:
error: failed to add watch (/srv/http/shop/lib/symfony/vendor/propel-generator/templates/sql/db-init/pgsql) [No space left on device]
inotify_add_watch returns ENOSPC when, to quote the manpage: "The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource.". You can modify this value by writing to /proc/sys/fs/inotify/max_user_watches, but there is a hard limit, and every watch consumes kernel resources.
]]> error: failed to add watch (/srv/http/shop/lib/symfony/vendor/propel-generator/templates/sql/db-init/pgsql) [No space left on device]
the entry in /etc/autochownd.conf looks like this:
> http:http-pub::/srv/http
Any idea which of the devices is it referring to? df's output doesn't show anything suspicious. According to find, there are
find . -type d | wc -l
18490
directories and
find . -type f | wc -l
57674
files in /srv/http
]]>To be clear, the latest version is 2013.2.13.1. If you are using 2013.*, upgrade immediately as there is a nasty bug in some of those.
]]>One comment - the service file passes in /etc/autochown.conf but the package (your repo) installs autochownd.conf.
Xyne wrote:Thanks, the path has been updated. It seems that you are the first to use the service file.
I just thought the others were being coy.
Take me in Actually that would have been in my feedback. Well, is part of*
skanky wrote:it's simple to configure for basic setups.
My own usage is very simple (and that's what I wrote it for) but I'm hoping the globbing will enable more complicated setups without too much complexity. If you at some point find the configuration file to be limited, let me know.
Does the job instantly as wished here Day to day usage for users, and sync (e.g. no more Dropbox "Couldn't sync this and that") will be really smoother now. Thank you Xyne!
(*) autochown-2013.2.13 won't compile in this location:
[ 75%] Building C object CMakeFiles/autochown.dir/src/file_parser.c.o
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c: In function ‘scan’:
/tmp/yaourt-tmp-kozaki/aur-autochown/src/autochown-2013.2.13/src/main.c:364:7: attention : ‘return’ with a value, in function returning void [enabled by default]
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c: Hors de toute fonction :
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c:448:3: erreur: unknown type name ‘wd_key_data_t’
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c: In function ‘main’:
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c:726:44: erreur: ‘remove_all_watches’ undeclared (first use in this function)
/tmp/yaourt-xxxx/aur-autochown/src/autochown-2013.2.13/src/main.c:726:44: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/autochown.dir/src/main.c.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
make[1]: *** [CMakeFiles/autochown.dir/all] Erreur 2
make: *** [all] Erreur 2
==> ERREUR : Une erreur s'est produite dans build().
Abandon...
==> ERREUR: Makepkg n'a pas pu construire autochown.
You can now specify per-filetype masks on the target line. For example, to enforce non-executable files you can use this:
> nobody:users:002R113:/path/to/whatever
The default mask is then 002 and it behaves exactly as before. After that is the file mask for regular files (R113). Whenever a regular file is encountered it will use that mask instead (i.e. not on top) of the default mask. The effect is thus to deny others write permissions on everything and everyone execute permissions on files. The recognized filetype specifies are listed in the man page. The underlying code uses the GNU C filetype tests: http://www.gnu.org/software/libc/manual … -File-Type
Once I had that I thought it might be useful to be able to restrict the filetypes allowed in the watched directory. I ended up creating a killmask (700), i.e. a mask that indicates that a filetype should be removed. Given the potential damage that it could do, it requires a command-line option to be enabled. One of the nice side-effects of the inotify system is that recursive directory removal is handled automatically if the files in the directory are removed by killmasks. I may add some way to actively remove a non-empty directory to enforce a flat directory hierarchy, but that a little is dangerous.
You can reverse the logic too and set a default killmask and then only allow certain filetypes to be created, e.g. regular files. Due to the way inotify events arrive, it's still possible to create directories with other things in them that won't get purged, but after the events arrive the only thing left in those dirs will be regular files.
Finally I added a dry-run option when I realized that testing the killmask might be dangerous otherwise and i didn't feel like playing comment tag.
The code has been improved in several places as well (bug fixes, more robust handling of certain event notifications).
Check the man page for more info about the changes. Ask if you have any questions after that.
]]>