Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-23-2011, 04:56 AM   #16
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386

Originally Posted by abubakar-malik View Post
EricTRA, i checked the both links you provided but unfortunately they do not fit to my requirement
Logic in those examples monitors directory changes and echo/alert me even if a file is modified, added or deleted while i only want to see the echo/alert when a new file is added in the directory.
This only shows you still didn't read the inotifywait man page. Hint: the "create" event. Also, bash is not C (nor C-like, for that look into csh which is another famous shell), as you -almost- intend in your snippet above.
1 members found this post helpful.
Old 02-23-2011, 05:15 AM   #17
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295

It's quite normal that what I pointed to isn't what you need :-) That would be all to great wouldn't it? I only pointed to those to give you an idea on where to start. I also mentioned in previous post that you 'could' use several things like crontab, sleep, make it a daemon that constantly runs in the background, ... There are more than one way to get to what you need. You just need to take the decision.
I want to process the log file and save the results into my internal DB.
Which log file and when? I imagine you just want to start processing a log file (following it) from creation until death (when a new one gets created). Just write a script that monitors your directory for number of files with timestamps (creation/modification) less then X time. From the starting point of the script you'd get the latest log file and monitor it (process), then sleep for a second, check the directory again to see if the file has modified and if it is then check for newly added content to the latest log and process it (diff, comm). If a new log gets created then you automatically process this new file since you'll only have one log file that has recently been changed/added. If you sort the log files by modification time and always get the latest one, I guess that should take care of it, regardless of how many log files you have and what their names are. Or am I not understanding you (once again)?

Kind regards,

Old 02-24-2011, 02:17 AM   #18
LQ Newbie
Registered: Feb 2011
Posts: 10

Original Poster
Rep: Reputation: 3
As you guys mentioned, i am going to install following three utilities;

I will play with them and at the end i will use one of them for actual deployment.

Thanks for all the replies
Old 02-24-2011, 04:17 AM   #19
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I don't know about incron ... it seems lovely from certain
points of view, but the lack of recursion is a major shortcoming
in my humble opinion. And e.g. feeding a complex directory
structure into a config file via find just seems ... un-geeky.
It's a kludge, and not a pretty one.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to perform two tasks at a time in kernel... raulapati Linux - Embedded & Single-board computer 2 01-18-2011 04:46 AM
[SOLVED] How to perform root level tasks while in GUI? jlavik Linux - Newbie 8 10-06-2010 10:39 AM
Can ks.cfg be added to a linux install boot DVD to perform kickstart installation? Latitude Linux - Software 2 06-05-2009 08:39 AM
Tasks to perform when host is connected to internet. venkat_k Red Hat 1 01-30-2009 03:52 AM
writing a script to perform a function on each users mail folder jhill Linux - Newbie 2 08-24-2004 07:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration