473,505 Members | 13,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

buffers readlines and general popen2 confusion...

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

May 21 '06 #1
3 1062
ar**********@onet.eu wrote:
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/Soft...gDog/v1.0-old/

-Larry Bates
May 21 '06 #2
In article <11**********************@j33g2000cwa.googlegroups .com>,
ar**********@onet.eu <ar**********@onet.eu> wrote:
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?


--
Jim Segrave (je*@jes-2.demon.nl)

May 21 '06 #3
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.

May 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7121
by: Guy | last post by:
Hi I was given an exstremly useful answer to a problem that I had in windows. I'm relativly new with python, but find it exstremly useful. I'm creating a script to run test files and record...
1
1701
by: A. Lloyd Flanagan | last post by:
OK, I've got a weird one I haven't been able to figure out yet. Admittedly I haven't had time to dig into the library source, but this behavior certainly doesn't seem right. Here's a test case: ...
1
3097
by: | last post by:
This could possibly be a bug, but I don't understand it fully so I'm posting here first. Searching the list told me other people are having this problem too. I have created a class which...
4
1654
by: P | last post by:
I've written a couple of apps that required running a command and grabbing the output, and I've found the existing interfaces problematic for this. I think the proliferation of functions and...
2
6191
by: Yong Wang | last post by:
Hi, I use readlines() to read one data file. Python automatically parses the read contents into a list of lines. When I used list to print out the 1st line, it is ok. When I use the list index 2...
1
2559
by: Magnus Lycka | last post by:
I'm trying to read standard out in a process started with popen2 in a non-blocking way. (Other good ways of doing this than the one I tried are appreciated.) I've tried to dumb down my code to...
9
1822
by: Martin P. Hellwig | last post by:
Hi all, I was doing some popen2 tests so that I'm more comfortable using it. I wrote a little python script to help me test that (testia.py): --------------------------------- someline =...
3
3087
by: mikem76 | last post by:
How do I automatically redirect stdout and stderr when using os.popen2 to start a long running process. If the process prints a lot of stuff to stdout it will eventually stop because it runs out...
1
1581
by: mikem76 | last post by:
Is there a way to get the process id when starting a process using os.popen2 or os.popen3 on linux? Mike
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.