Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

continuously monitor program

Status
Not open for further replies.

nychris

MIS
Dec 4, 2004
103
0
0
US
I have a systemtap script (loop.stp) that continuously runs and prints output periodically. I want to monitor this output from a perl script. Why does this code below not print anything? If I change this to /bin/ps, it does print the entire output when the command exits. I need it to print output as it occurs since the program will never end.

Code:
open(STAP, "/root/loop.stp");
while ( <STAP> ) {
  print;
}
 
Typo above, I forgot the pipe. This only prints when the command exits, not in real time.

Code:
open(STAP, "/root/loop.stp |");
while ( <STAP> ) {
  print;
}

--
Chris
RHCE, SCSA, AIX5L, LPIC, CNE, CCNA, MCSE
 
FYI, forgot to include this in the original post. If I change the program to monitor another perl script and add "$| = 1" in the other perl script, this works. I need to do the equivalent in the systemtap script somehow.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top