Skip to main content

Posts

Showing posts with the label inotify

Remote Working and non-reliable ISP

Having agreed with my manager, who was kind enough to allow me to work from home while away in India (my home country), I was quite eggsited about the Easter break. As usual, I was visiting my family, and was hopeful that it will workout OK for me, but it turns out that the country seem to develop backwards! Basically the ISP in my town here is quite appalling! A strong breeze and the connection is gone! Summer rains which is usually associated with thunders, makes it worse! Power-cuts or load shedding as they call it, is cherry on the cake! So I am left with a home setup that has a few KVA backup power but no reliable Internet connection! So I am having to work offline mostly and then sync occasionally! Some people might think, why not use a remote filesystem like SSHFS (fuse mount over SSH); I could, if the connection was stable, it is a no go area on unreliable link, as the mount hangs when link goes away! Surely, what is said in the title is norm...

cups-pdf : wish it could open when done

Its been something I always wanted in cups-pdf; to see the PDF output from the printing. Just to make sure that the printer didn't run out of ink! After a bit of digging, I managed to get it working with inotify-tools. Here is what I had to do. sudo apt-get install inotify-tools inotify is one of the facilities in Linux that I adore. Very scalable; have used it extensively in production environment that fires a few thousand events per second (it is capable of doing a lot more). For our purpose, we need to setup an event monitor and make the event do something; which is in our case monitor for write+close event, and ask gnome (in my case) to open the file. The best we can do is to run a background script on gnome session startup . The script as below; make sure you set execute permission on the file. #!/bin/bash if [ "$1" != "-nohup-" ]; then     nohup $0 "-nohup-" </dev/null &>/dev/null &     exit 0; fi inotifyw...