Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to detect that written textfile has closed

Status
Not open for further replies.

aschneck

IS-IT--Management
Oct 31, 2002
12
DE
Hi there,
I have a bit terrific problem / question.
I have to write some scripts that should automate some functions in our sun-environment.
We have several cobol programs that are running against an oracle db on the sun. Those programs create textfiles on the system (e.g. a listing of something). Now those files should be send automatically from inside shell-scripts via email or ftp to people/ftp-sites.
Sending those files via email/ftp is not a problem.
My problem is to detect when a file is ready to send. Example: Suppose the script shell check the directory /files/dir1 and send every file there via email and this script will started every hour by cron. Now just while the script checks the directory a cobol program is still running and writing to a file that it has created in /files/dir1.
How could I check in the script, that this file is still written and shouldnt be send?
Any ideas?
Axel
 
HI,
thanks, I just tried it. On the Cobol programs it seems working. What I wondered about was when opening a textfile in mcedit (editor from midnight commander) this file wont be shown as open/user by fuser.
regards,
Axel
 
Axel:

Most editors - vi included - work with either the contents of a file in a buffer or a copy of the original file. The editor only has the file "open" when you command the editor to explicitly save the contents, and that's probably the only time fuser shows the file as being opened.

Regards,
 
Axel:

Most editors - vi included - work with either the contents of a file in a buffer or a copy of the original file. The editor only has the file "open" when you command the editor to explicitly save the contents, and that's probably the only time fuser shows the file as being opened.

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top