Comments on How to trigger commands on File/Directory changes with Incron on Debian
This guide shows how you can install and use incron on a Debian 9 (Stretch) system. Incron is similar to cron, but instead of running commands based on time, it can trigger commands when file or directory events occur (e.g. a file modification, changes of permissions, etc.).
5 Comment(s)
Comments
I've configured the Icron in ubuntu to capture changes in known_hosts file
user=`eval echo ~$USER`
echo $user
/home/alex
$user/.ssh/known_hosts IN_MODIFY echo "$$ $@ $# $% $&"
if that known_hosts I don't see any notifications that it changed. (i verified the change - host key of remote server actually changed)
why incrontab don't work in this case? what can be done to make it work? maybe some other tool?
Thanks!
Hi Alex,
Make sure you setup your incron monitoring using incrontab -e. You can't call Incron within a script.
"(meaning the directory and/or the files directly in that directory (not files in subdirectories of that directory!) are watched)"
This seems to not be true with current versions; the project isn't quite as abandoned as it used to be. Now you need to specify "recursive=false" in the mask if you don't want it to be recursive.
Nice and simple article and way easier than the man page. But...Incron doesn't do exactly what I want:
I have one server with ISPConfig3 that acts as primary DNS.I have another server as secondary DNS and at the moment it is not possible to install ISPConfig3 on it. So... how to automagically transfer the domains to NS2? No problem as soon as the domain is defined on NS2, but how to make the initial push? Incron to the rescue!I monitor the /etc/bind/ directory and on creation of a zone file (keep in mind you have to ignore certain files; you only need the `pri.domain.tld` file) I trigger rndc to push it to NS2. But what on deletion of a domain? I thought I could use IN_DELETE, but alas: it doesn't even seem like the job fires :( Any ideas?
I tried to use this program on raspberrypi without success, it does not work, sometimes it displays an error message that the file does not exist even though it exists, other times it does not display any error message without working, i try to reboot.However, I used incroneta -e for the configs and added root to /etc/incron.allowUninstalling ...