Shell script running as a daemon?
Mateus Interciso
p.zarnick
Thu Jul 19 18:39:13 PDT 2007
On Thu, 19 Jul 2007 21:21:26 -0400, Kurt Wall wrote:
> On Jul 19, 2007, at 7:30 AM, Mateus Interciso wrote:
>
>> On Wed, 18 Jul 2007 21:59:36 -0400, Kurt Wall wrote:
>>
>>> On Jul 18, 2007, at 8:51 PM, Mateus Interciso wrote:
>>>
>>>> Hello, I'm planing on making a (hopefully) simple shell script that
>>>> act
>>>> as a daemon. This particular shell script should keep watching a
>>>> folder,
>>>> and wenever a new txt file(all files that arrive on that folder are
>>>> txt)
>>>> arrives, it should grep trough it, and take some actions. My question
>>>> is if it's possible to make this kind of daemon?
>>>
>>> Sure. You're probably reinventing the wheel, but such a shell script
>>> is
>>> trivial to write:
>
> [script snipped]
>>
>> Kurt, thanks a lot, this will for sure help. But why do you say that
>> I'm reinventing the whell?
>
> I'm not criticizing, just suggesting that someone else has probably
> already solved this problem and a quick search on Freshmeat or
> SourceForge will show you what other people have done.
>
>> What I want is to create a daemon that keeps looking at a Maildir/cur
>> folder, grep all new messages, and acording to the grep, it does some
>> kind of action. I tought that a daemon was the best thing to actually
>> do,
>> but if there's other way, a bether one, please enlight me.
>
> There's more than one way to do it. A daemon is absolutely a valid
> approach. A cron job is another way. What you are describing is a "biff"
> (a mail notifier) that runs an external process (your grep and "some
> kind of action") when it detects new mail.
>
> Again, I'm not criticizing your idea, just suggesting that it has
> already been solved. There's nothing wrong with solving it again,
> either. Who knows, maybe you'll solve it in a newer, better, smarter
> way.
>
> Best regards,
>
> Kurt
Thanks Kurt, I didn't tought you were criticizing...not at all...
I'll take a look at freshmeat and see if I can find something.
Once again.
Thanks for all the help.
:D
Mateus
More information about the Linux-users
mailing list