Check EOF in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check EOF in shell script
# 8  
Old 07-20-2007
You could try "fuser"
# 9  
Old 07-20-2007
Code:
typeset -i mCnt
mFile='Test_File'
while true
do
  touch ${mFile}
  echo "Sleeping for X seconds at "`date`
  sleep X
  for mEachFile in `find . -type f ! -newer ${mFile}`
  do
     ...move ${mEachFile} to its new location...
  done
  mCnt=`find . -type f -newer ${mFile} | wc -l`
  if [ $mCnt -eq 0 ]; then
    break
  fi
done
rm -f ${mFile}

Where 'X' is whatever number of seconds you think it is necessary to be
sure there is no more writes done to a file.

Last edited by Shell_Life; 07-20-2007 at 05:03 PM.. Reason: A comprehensive solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

2. UNIX for Dummies Questions & Answers

multiple if conditions and EOF in a shell script

I want to create an IF condition with multiple condition, in the statement below I want to add OR EOF, can any one please advise how to do. if } != $sample ] && ; then echo ..... fi code tags please (1 Reply)
Discussion started by: analyst
1 Replies

3. Shell Programming and Scripting

Need EOF usage in shell scripting

Hi all, Can any one explain the usage of EOF in shell scripting?? Gone through some examples from google, but it is not clear... Examples are: 1. $ tr << EOF > abcd > efgh > iojk > EOF O/P is: ABCD EFGH IOJK 2. echo << EOF (1 Reply)
Discussion started by: divya bandipotu
1 Replies

4. Shell Programming and Scripting

Oracle Shell script | here document `EOF' unclosed

Hi folks I m creating script which is give me below error. $ ./function.ksh ./function.ksh: here document `EOF' unclosed Inside the script is #!/bin/ksh export ORACLE_SID=OECDV1 export ORACLE_HOME=/u01/app/oracle/product/10.2.0 export PATH=$ORACLE_HOME/bin:$PATH echo "sql is... (3 Replies)
Discussion started by: tapia
3 Replies

5. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

6. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

7. Shell Programming and Scripting

How to find EOF character in a Shell ?

Hi, I'm need to determine if a file contains the EOF character, how can I do that in Shell scripting? Regards. (1 Reply)
Discussion started by: jfortes
1 Replies

8. Shell Programming and Scripting

check my first shell script

I have written the below script to determine whether a string is palindrome or not ? But its not working, any help to debug it ? I am new to this forum but when I searched for my question, I found that many people refused to answer this question thinking that its Homework question, Therefore I... (2 Replies)
Discussion started by: gridview
2 Replies

9. Shell Programming and Scripting

check in unix shell script so that no one is able to run the script manually

I want to create an automated script which is called by another maually executed script. The condition is that the no one should be able to manually execute the automated script. The automated script can be on the same machine or it can be on a remote machine. Can any one suggest a check in the... (1 Reply)
Discussion started by: adi_bang76
1 Replies

10. Shell Programming and Scripting

How to check if the file DOES NOT have EOF

Hi, Please help me on this. how to check if the file DOES NOT have EOF ?? I am using ksh for this. (3 Replies)
Discussion started by: BasavarajaKC
3 Replies
Login or Register to Ask a Question