Support inotify to watch crontab directories#11
Open
gagern wants to merge 2 commits intodubiousjim:masterfrom
Open
Support inotify to watch crontab directories#11gagern wants to merge 2 commits intodubiousjim:masterfrom
gagern wants to merge 2 commits intodubiousjim:masterfrom
Conversation
This may lead to crontabs being re-read twice, once triggered by inotify and a second time by cron.update. This should be no serious problem, though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If compiled with
make CPPFLAGS=-DUSE_INOTIFY, thencrondwill now monitor both crontab directories, and will immediately synchronize any files right after they have been closed or deleted. So far this feature is completely undocumented. I gave it a tiny bit of testing, and it appears to work well enough. I haven't attempted to verify all the error code paths, since for most of the errors I don't even know how to deliberately trigger them.This change may lead to crontabs being re-read twice, once triggered by inotify and a second time by
cron.update. This should be no serious problem, though.The code is heavily based on the example in the inotify man page. On the other hand, except for choosing different names for variables, there probably isn't much room to do things very different from this, so I'm not sure whether we'd have to add a notice to credit the man page authors in accordance with the man page license. Come to think of it, the dcron code should probably specify what version of the GPL to apply.