
On 08/27/2015 02:02 PM, Brian May wrote:
On Thu, 27 Aug 2015 at 13:08 Trent W. Buck <trentbuck@gmail.com <mailto:trentbuck@gmail.com>> wrote:
fakeroot(1) can do this, I think. LD_PRELOAD is one of the available strategies.
fakeroot doesn't intercept open():
brian@prune:~$ fakeroot touch /etc/newfile touch: cannot touch ‘/etc/newfile’: Permission denied brian@prune:~$
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main Hi, Some time ago I needed a script which would detect that Cheese had taken a photo, it then acted on that by printing the file and then sending it to the "Printed" folder. I forget the handle of the guy who sent me the script but it relied on "inotify" and to my mind it may be close to what is needed, this is not my work but here it is:
inotifywait -m -e close_write ~/Pictures/webcam --format "%w%f" | \ while read filename; do lpr -P Photosmart-C5200-Series "$filename"; mv "$filename" ~/Pictures/webcam/printed; done The inotifywait (part of the inotifytools package) waits for writes to the folder. The '-m' flag makes it run indefinitely (instead of running it in a script loop which could mean it might miss an event). The '--format' outputs only the file names that were written. The output of the inotify is piped to a while loop (alternatively xargs could be used to run a command for each filename input). The while loop reads the filename from standard input, prints it to the printer, and then moves it to the destination directory. If you are using CUPS for your printing, then there are some image processing options that can be specified if the default is not what you want. BTW the resulting Photobooth was a resounding success Andrew Greig (I noticed your question on the MLUG list, but hadn't had a chance to respond).