Koozali.org: home of the SME Server

Watch folder for processing files

Offline erroneus

  • ***
  • 62
  • +0/-0
Watch folder for processing files
« on: January 15, 2009, 08:27:09 PM »
Recently, a small office of three users stopped being able to plot CAD plot files to their plotter.  I set up a print queue and they ran a batch file to copy their plot files directly to the print queue using "copy filename.plt /b \\server\printer" and it had been working for quite some time.  It has stopped working inexplicably, but in testing things, I realized that I could send these plot files to the print queue using a Linux command line.  That's when the idea hit me.

I would like to set up a watch folder where the user can copy plot files.  The server should be able to watch this folder and send any plot files it finds to the print queue.  Ideally, I would like this to run in a bash script.

Has anyone done this before?  Is there a contrib for anything resembling this that I have been unable to locate?  I am sure I can pull this off with some cron job and some scripting, but I know there are people here way smarter than me and can do it a lot better and in a way that fits within SME server's framework and methods of doing things.

Help?  Suggestions?

P.S. I know about inotify.  It isn't available in 2.6.9 kernels without a patch.  It will be available in SME 8 when it is released, but I would like to get this going in SME 7.4.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Watch folder for processing files
« Reply #1 on: January 15, 2009, 08:30:26 PM »
Help?  Suggestions?
You can not connect the printer to SME Server and configure the plotter as a network printer? And print in the normal way from a (windows) application?
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline erroneus

  • ***
  • 62
  • +0/-0
Re: Watch folder for processing files
« Reply #2 on: January 15, 2009, 09:00:56 PM »
No.  These are plot files generated from other people and transmitted to these users.  The way to use plot files is to dump them to plotter in some way.

In any case, being able to set up processing (of any type) against a watch folder is a very useful thing.  Making PDFs, doing print jobs, processing photos, videos or MP3s... torrent files!

Offline elmarconi

  • ****
  • 139
  • +0/-0
Re: Watch folder for processing files
« Reply #3 on: January 19, 2009, 08:06:11 PM »
Let me see, I used a customized smb template to do some filtering on a print job from a dirty old aplication that would only print to Epson matrix printers:

Code: [Select]
[printqtxt]
comment = Filtering LPT Queue
; path = /home/e-smith/files/samba/tmp
path = /tmp
printable = yes
guest ok = yes
print command = /usr/bin/printqtxt %s

; There is no need to support listing or removing print jobs,
; since the server begins to process them as soon as they arrive.
; So, we set the lpq (list queued jobs) and lprm (remove jobs in queue)
; commands to be empty.
lpq command =
lprm command =

The processing /usr/bin/printqtxt happened as soon as the printjob had arrived:
print command = /usr/bin/printqtxt %s

...

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Watch folder for processing files
« Reply #4 on: January 19, 2009, 08:09:13 PM »
Let me see, I used a customized smb template to do some filtering on a print job from a dirty old aplication that would only print to Epson matrix printers:

Code: [Select]
[printqtxt]
comment = Filtering LPT Queue
; path = /home/e-smith/files/samba/tmp
path = /tmp
printable = yes
guest ok = yes
print command = /usr/bin/printqtxt %s

; There is no need to support listing or removing print jobs,
; since the server begins to process them as soon as they arrive.
; So, we set the lpq (list queued jobs) and lprm (remove jobs in queue)
; commands to be empty.
lpq command =
lprm command =

The processing /usr/bin/printqtxt happened as soon as the printjob had arrived:
print command = /usr/bin/printqtxt %s
I think it is bad practice to expose your /tmp directory. I think you should create a seperate directory for this purpose.
Besides that not only print jobs to be queued are in the /tmp folder.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline elmarconi

  • ****
  • 139
  • +0/-0
Re: Watch folder for processing files
« Reply #5 on: January 19, 2009, 08:27:10 PM »
I think it is bad practice to expose your /tmp directory. I think you should create a seperate directory for this purpose.
Besides that not only print jobs to be queued are in the /tmp folder.

I could not agree more but this origins from my early days with E-smith 4.1.2...
The dirty copy-paste job i did was to show another possibility.
...