buffers readlines and general popen2 confusion...

A

aristotelian

I'm interested in taking the output of a daemonized shell script that
greps for patterns which would act as an argument to a script. Is it
better to write this stuff to file and visit the file every few seconds
or can this be done a better way. I'm hoping for a more elegant
solution. So far I've seen some troubling info about buffer overflows
with popen2 but it looks like the low-hanging fruit. I'm not a unixpro
so I want to make sure anything I tackle is best practice. Suggestions
welcomed.

-Aris
 
L

Larry Bates

I'm interested in taking the output of a daemonized shell script that
greps for patterns which would act as an argument to a script. Is it
better to write this stuff to file and visit the file every few seconds
or can this be done a better way. I'm hoping for a more elegant
solution. So far I've seen some troubling info about buffer overflows
with popen2 but it looks like the low-hanging fruit. I'm not a unixpro
so I want to make sure anything I tackle is best practice. Suggestions
welcomed.

-Aris
Sounds like you should take a look at logdog. It uses fifo files to
send the output of /var/log/messages and greps them for patterns.
As the daemon just looks at the fifo file for any input, it is quite
efficient.

I could be way off base about what you are trying to do, but it still
might we worth a look.

http://caspian.dotconf.net/menu/Software/LogDog/v1.0-old/

-Larry Bates
 
J

Jim Segrave

I'm interested in taking the output of a daemonized shell script that
greps for patterns which would act as an argument to a script. Is it
better to write this stuff to file and visit the file every few seconds
or can this be done a better way. I'm hoping for a more elegant
solution. So far I've seen some troubling info about buffer overflows
with popen2 but it looks like the low-hanging fruit. I'm not a unixpro
so I want to make sure anything I tackle is best practice. Suggestions
welcomed.

I'm puzzled - a daemonised program normally closes stdin/stdout/stderr
and disconnects from its controlling terminal, so where is its output
going?
 
A

aristotelian

That's just it. I was hoping to have python listening for events and
responding continually according to the demaons stdout. That's why I
mention popen2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top