Results 1 to 4 of 4
Hi,
I have a shell script which monitors a file at fixed intervals. This file is continuously being written, so my shell script gets only the freshly written information in ...
- 04-06-2010 #1Just Joined!
- Join Date
- Apr 2010
- Location
- Boston
- Posts
- 1
multithreading in linux
Hi,
I have a shell script which monitors a file at fixed intervals. This file is continuously being written, so my shell script gets only the freshly written information in the file when it is executed the next time (i have put it in the cronjob).
Now i want to extend this script to monitor any number of files concurrently. Any suggestions?
Right now if i want to monitor say 3 files then i have 3 copies of the same script (gave them different names .sh) handling 3 individual files.
Best,
Life
- 04-06-2010 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
You don't explain fully what your goal is.
To "check" 3 files when the script is run...specify them as parameters to the script and have the script handle them appropriately. Or alternatively, hard code them in the script itself.
Bash Scripting
If you want your script to check all files *in parallel* to reduce runtime, Google "parallel bash scripts." This will likely require heavy-rewriting of your script.
- 04-06-2010 #3
Heh, have a look at this:
Home - inotify-tools - GitHubDebian GNU/Linux -- You know you want it.
- 04-07-2010 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
GNU-Fan is absolutely correct. Use the inotify tools to monitor changes to files and/or directories.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote