> I wanted to setup dnotify to automatically rebuild my hdlists for my > mirror. But I also wanted to make sure it always started. So I wrote a > small init script for it. Attached is a conf file to put in > /etc/sysconfig/dnotify and an init script to put in > /etc/rc.d/init.d/dnotify. > > Unless you configure dnotify args it will not start dnotify even if you > have it enabled. So it's safe to add to the package and enable by > default. :)
I agree; this would be a useful thing to add to the standard dnotify package. But I'd suggest two minor changes. It might be better to have an /etc/sysconfig/dnotify.d directory instead of a single file. This is easy, and potentially useful (e.g., for future packages to drop their own dnotify commands in place). Also, I think better examples would be very helpful. Yeah, it's not too hard to figure things out from the manpage, but on the other hand, the examples that are provided. are more apt to be confusing than helpful to a newbie. Running dnotify -A /etc -e echo change will print "change" whenever a file in /etc is read--but not when a file in /etc is changed. And the other example will call "informdelete" whenever a file in /var/mail is deleted, but also whenever one created. So, it'll be triggered whenever a mailbox is created or destroyed, which is unlikely to be a good reason to call something called informdelete. So, both of the examples are more likely to confuse than enlighten newbies. Also, the first example will print "change" to stdout, which is not likely to be what you want in a program backgrounded by an init script. And the second will likewise print its output to stdout--and, if informdelete returns nonzero, dnotify will print a warning to stderr. So, examples showing redirection would also be nice. And, since dnotify will run everything as root, examples showing dropping root might be handy. Finally, it would be nice to have examples of something someone might want to actually do. Something like this: -CDMRB -r /etc/httpd -e service httpd configtest >> /var/log/dnotify -CDMR -p1q0 /var/mirror/urpm -e su -c'/usr/local/bin/rebuildhdlist >> /var/log/urpmirror' urpmirror etc. It might even be better to have cron-ish TSV/CSV/whatever config files, so it could just be something like: #cond dir recurse procs queues user stdout[:stderr[:dnotifyerr]] cmd CDMRB /etc/httpd r - - - - service httpd configtest CDMR /var/mirror/urpm - 1 0 urpmirror /var/log/urpmirror:- /usr/local/bin/rebuildhdlist But that's probably overkill. Just a /etc/sysconfig/dnotify.d and a set of useful examples, and I'd be more than happy. By the way, has anyone noticed that the notify manpage says that --all is shorthand for "-AMCDRO" when actually it's "-AMCDRB"? I seem to remember there used to be a -O flag (the possible flags were -DMACRO, which was an easy mnemonic for anyone who's ever compiled a C program), probably for chown? Anyway, I sent an email to the original author about that.
