G'day Striker,
I have a different version of top (with different options) so I can't test this. However, looking at this top manpage (which appears to have the same options that you're using), I'd guess you can add a -n iterations to your top command; then put a sleep between the system statements.
So, with a delay of 5 seconds, that would be 36 iterations in 3 minutes:
system "top -p 1758 -b -d5 -n36 | tee -a stats.log"; sleep 180; system "./top_stats.sh -f stats.log";
According to that manpage, top should stop running after the set number of iterations, so you won't need a Ctrl-C (or equivalent).
-- Ken
In reply to Re: Running 'top' command (of linux) for few minutes and then come out of system command (of perl)
by kcott
in thread Running 'top' command (of linux) for few minutes and then come out of system command (of perl)
by Striker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |