Linux - NewbieThis 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.
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:
Code:
top -<BLABLA>
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.
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
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?
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?
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. When 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!?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.