Quote:
Originally Posted by
balajesuri
I don't see why you're performing
cat on a directory. Is this a typo? If not, you will not get your intended results. Also, you can grep directly on the file instead of piping the cat output to grep. Read
this "useless use of cat".
sorry that is a typo when written into the forum
mytest15=`cat /pathtofile/filename | grep -c filename.$DATE.TXT | grep TRL | wc -l`
basically i know the file has completed writing when it has the word TRL in the file.
---------- Post updated at 02:10 AM ---------- Previous update was at 02:04 AM ----------
Quote:
Originally Posted by
Peasant
Other then mentioned, use #!/bin/bash -x and examine the nohup.out during the hang.
If you are on linux system, inotify should provide much better interface for actions on file changes.
Please, if you can, post the entire code and/or explain what are you trying to do so perhaps a better approach could be written.
Hope that helps
Regards
Peasant.
-x i will give that a try.
im positive it could be written a hell of alot better as im still very new.
what the script does is waits for a file to be written to a directory.
when that file arrives, it then waits for it to finish being built by looking for TRL inside the file.
Then it renames the file and moves it.
as i said ran ti yesterday worked fine.
ran it today in the background it didnt see that the file arrived.
so i killed it then ran it
ran it normally...it spotted the file and worked as expected.
i just dont understand why it was in the background it didnt notice that the file was there, and yesterday it worked fine