I'm assuming that you are basically implementing a spooler that has files copied to it 
from remote workstations, and need to use files to communicate. Can you arrange to 
have the remote workstations create a zero-length file print_file.lock that indicates 
to your script that something is still writing to print_file? Then your remote 
workstation can delete print_file.lock and the spooler can safely print the file.

Apart from the lsof suggestion from Roger you can also do a 'ls -l' and check that the 
file size hasn't changed for say 30 secs and then you can assume that the job is done 
(or the sending workstation has died :-()

(There are also is a prebuilt fifo / named pipe listening utilities (can't find them 
now) that will execute a command when it is written to/from) 

Martin

Martin Visser ,CISSP
Network and Security Consultant 
Technology & Infrastructure - Consulting & Integration
HP Services

3 Richardson Place 
North Ryde, Sydney NSW 2113, Australia 

Phone: +61-2-9022-1670��� 
Mobile: +61-411-254-513
Fax: +61-2-9022-1800���� 
E-mail: martin.visserAThp.com
  

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Peter Chubb
> Sent: Friday, 5 March 2004 3:44 PM
> To: Lyle Chapman
> Cc: [EMAIL PROTECTED]
> Subject: Re: [SLUG] Print Script
> 
> >>>>> "Lyle" == Lyle Chapman <[EMAIL PROTECTED]> writes:
> 
> Lyle> Can anyone help?  I have a print script in bash that monitors a 
> Lyle> certain folder, when that folder is populated with a postscript 
> Lyle> file it is converted to a pdf and then printed to a selected 
> Lyle> printer.
> 
> Why not get whatever is generating the postscript to pipe 
> directly to lpr instead?  Only the generating program can be 
> sure that it's finished -- even ls -l and waiting for the 
> size to stop increasing isn't guaranteed to work.
> 
> Peter C
> --
> SLUG - Sydney Linux User's Group Mailing List - 
> http://slug.org.au/ Subscription info and FAQs: 
> http://slug.org.au/faq/mailinglists.html
> 
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to