An inotifywait question
Greetings all;
I am as you have proably guessed by now, the originator of some bash
scripts that greatly simplify the day to day background operations.
Two of these "scripts" make use of inotifywait to hand them the data they
need to do the rest of their jobs.
One of them watches /var/spool/mail and is dependent on finding the
$pidof kmail so it kmail isn't running, it will not send a message to
kmail over the dcop or dbus facility and thereby stuffing up the buffers
either of these use.
However, there are generally two instances of inotifywait running because
I also use a session to watch another directory where a .jar file
running as drivewire for a legacy computer in the basement, so that I
can send a file to a printer it thinks is attached to that machine, but
which in reality is actually sent up the usb cable to this machine and
dropped into a file here.
Simplified, that file, when closed by drivewire, is then sent via an lp
command in that script, thru cups which renders it, then sends it back
down that same usb cable to a brother B&W laser printer on that
computers desk, where it gets spit out in a beautiful font, at 19 ppm,
which is about 20x faster than any pin pounder printer that was ever
connected to it 30 years ago.
However, if something goes aglay, my scripts try to kill the inotifywait
session, and go silent until the proper $pidof's are present again.
But occasionally they will kill each others inotifywait sessions as I am
currently doing that kill with killall $name. Not the correct way
obviously to kill the session that THAT script started.
Because inotifywait is not silent when it launches, I have been forced to
do an "var=inotifywait $option_string 2>&1 >/dev/null &" to absorb the
noise. Am I dumping the PID return? Can I save that launch return and
use it to do a specific "kill $savedvar"?
The manpage for inotifywait is silent in this regard, but I suspect I am
looking at the wrong manpage. Perhaps, since its a bash script in both
cases, its the bash manual I should be studying?
Thanks for any clues. The bash manual, at around 500 pages, details
aren't that easy to find in that tome.
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
Reply to: