![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Gentoo Gentoo Linux is a versatile and fast, completely free Linux distribution geared towards developers and network professionals. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SFTP in batch Mode | ilok | AIX | 1 | 08-28-2007 01:25 AM |
| Sftp in Batch Mode | sivaemn | UNIX for Advanced & Expert Users | 2 | 07-01-2007 06:52 AM |
| SSH in batch mode and File-Handles in a loop | DaveCutler | Shell Programming and Scripting | 3 | 04-03-2007 06:39 AM |
| su command in batch mode | Rajesh Gohad | Shell Programming and Scripting | 3 | 01-26-2007 12:54 AM |
| SFTP in batch mode | mlim1111 | Shell Programming and Scripting | 5 | 01-23-2006 04:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
top in batch mode, cpu info is wrong
well. the title says it all.
im runing top in batch mode like this Code:
top -b -n1 > somefile if i run top normally, the first second, i see the same wrong info, and then it corrects itself. i found only one small mention of it on this forum. with this link top(1): tasks - Linux man page in the bugs section, it says to use a env variable called CPULOOP, but my top is not paying attention the system is gentoo Code:
cat /etc/gentoo-release Gentoo Base System release 1.12.11.1 Code:
top -V top: procps version 3.2.7 Code:
top -b n2 > somefile so any help on how to fix this would be greatly apreciated pd: the that uses top is the one been discused here http://www.unix.com/linux/75765-cpu-...-hard-way.html |
|
||||
|
If the second iteration is correct you can shorten the delay with the -d option and print the result of the second iteration with awk, this works on a Debian Linux system:
Code:
top -b -n2 -d0.01 | awk '/^top/{i++}i==2' > somefile
|
|
|||||
|
Quote:
this is a screenshot of my script (below) and top at the same time. screenshot on Flickr - Photo Sharing! |
|
|||||
|
Quote:
it searchs for a line begening with "top", and when is found, increment i,and if i equals to 2 ..... if you are trying to use awk to filter the output to get the same result as one run, then why....., shouldnt there be a print somewhere ? similar to this? Code:
top -b -n2 | awk ' /^top/ { i++ } \
i == 2 {print }' > somefile
i could use something like NR >= $(top height) keep in mind that im trying to fit all this in one awk, but each day it gets more complicated |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|