Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-02-2010, 06:46 AM
|
#1
|
|
LQ Newbie
Registered: Aug 2010
Posts: 18
Rep:
|
TOP problem
Hi guys,
I am new to Linux and I have the following problem:
I have the "top" command and I want to override its default behavior for every user, even for future users.
Writing with "W" in top is not an option as my top command somehow overrides the custom behavior per user and always turns to default behavior.
So, what I am asking for is, are there command line switches that override default behavior of top,
for example:
to show me the load average per core which would be equivalent to starting top first and then pushing the key "1" on the keyboard.
Remember, writing to toprc is not an option for me as top for some reason ignores its config and just goes for default behavior.
Edit: it seems to me this is a bug in the procps package. That is why I updated it to the latest version for my distro
CentOS 5.5 and procps to the following
http://rpm.pbone.net/index.php3/stat...86_64.rpm.html
HOWEVER, it doesn't work even now.
I can't believe that nobody in this forum haven't seen the problem.
Last edited by babaqga; 09-02-2010 at 09:02 AM.
|
|
|
|
09-02-2010, 09:30 AM
|
#2
|
|
Member
Registered: Jan 2005
Location: UK
Posts: 55
Rep:
|
This is potentially a bug in the version of top that you are running.
If it is not reading .toprc from the user's home directory then it could be related to the fix posted upstream at http://procps.cvs.sourceforge.net/vi...1.132&r2=1.134
It is worth filing a bug against centos 5.5
|
|
|
|
09-02-2010, 10:15 AM
|
#3
|
|
LQ Newbie
Registered: Aug 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by lurker79
This is potentially a bug in the version of top that you are running.
If it is not reading .toprc from the user's home directory then it could be related to the fix posted upstream at http://procps.cvs.sourceforge.net/vi...1.132&r2=1.134
It is worth filing a bug against centos 5.5
|
Already did that, but not with centOS, as it got shipped with an older package of procps that still doesnt' work. I installed the latest rpm
procps-3.2.7-16.el5
but it is the same story. The thing is it works perfectly when called locally by the script, but this same script, when called by the same user using nrpe, doesn't behave correctly. I am not really sure who is to blame.
To summarize:
Top behaves differently when called with the same user respectively from nrpe and from a locally residing script. I assume it SHOULD have the same config (/home/nagios/.toprc) but when called from nrpe, it ignores its home directory and switches to default. Any hints?
|
|
|
|
09-02-2010, 12:06 PM
|
#4
|
|
Member
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Posts: 530
Rep:
|
Quote:
|
So, what I am asking for is, are there command line switches that override default behavior of top,
|
Have you tried checking the manual for switches?
Play Bonny! 
|
|
|
|
09-03-2010, 02:14 AM
|
#5
|
|
LQ Newbie
Registered: Aug 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by Soadyheid
Have you tried checking the manual for switches?
Play Bonny! 
|
Are you actually serious with your question?
I hate derogatory remarks.
Did you at least read what I wrote above?
If you did you might wanna check YOUR top man and tell me why it behaves differently WHEN CALLED FROM THE SAME USER, although the /home/<user>/.toprc file exists?!
Is there anyone else who actually read my question?
|
|
|
0 members found this post helpful.
|
09-03-2010, 02:17 AM
|
#6
|
|
Member
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Rep:
|
Does the script change directory at all?
in the script, before you call top, get it to echo $PWD to see where the script is running.
|
|
|
|
09-03-2010, 02:26 AM
|
#7
|
|
LQ Newbie
Registered: Aug 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by djsmiley2k
Does the script change directory at all?
in the script, before you call top, get it to echo $PWD to see where the script is running.
|
The script does change the directory, as I explained, however, sometimes unpredictably...
Here is the problem:
1. W hen called locally with user nagios, the script changes the directory as I wish, because it uses the top command for user nagios, which has its configuration file in /home/nagios/.toprc.
2. However, when called from a deamon (nrpe) with the same user (nagios), the script changes the directory in a different way, because top IGNORES its configuration file and switches to default.
P.S I am absolutely sure that the script is called with the same user on both occasions because I straced it, lsof-ed it and what else.
My question is the following: is there anything else besides user name that tells top where to find its config file. In the documentation it says there isn't. If that is so, top sometimes ignores its configuration file and that is a bug.
P.P.S. This was indeed a bug in procps library but in 2006. As far as I see in the bug fixes, this bug was addressed. However, I am with the newest release and it still bugs. Any hints?
P.P.P.S I am now actually even surer, as I made a "whoami" and in both cases the user is nagios. HINTS!?
Last edited by babaqga; 09-03-2010 at 02:33 AM.
|
|
|
|
09-03-2010, 02:36 AM
|
#8
|
|
Member
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Rep:
|
All I know is I have the same bug in gentoo, with the newest version of top and its something to do with the way it writes out the config file.
However this doesn't explain the behaviour your seeing (as if its accessing two different versions of top
|
|
|
|
09-03-2010, 02:47 AM
|
#9
|
|
LQ Newbie
Registered: Aug 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by djsmiley2k
All I know is I have the same bug in gentoo, with the newest version of top and its something to do with the way it writes out the config file.
However this doesn't explain the behaviour your seeing (as if its accessing two different versions of top
|
Yep, I wrote the guys at procps, but no reply so far.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:51 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|