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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cpu usage

Status
Not open for further replies.

vti

Technical User
Feb 26, 2001
189
TR

Hi all
Ý have a really enoying problem.
My problem is ;there are 750 client on my Tru64 server and there are 4 cpu on my server.And nearly every night, after users are gets logoff i still see 1 or 2 user on my system .Everyday i see different users .And they use over of %90 one of 4 cpu's.I can fix it with kill the process by a script,that's the way i am using .But I 'd like to find that is the reason.

Any clue?

Regards
 
Yep -- this happens sometimes.

There seem to be a couple of different causes.

I've seen it in two different scenarios, and maybe other people can chip in with cases as well.

1 -- Some user process crashes and manages to detach itself from the keyboard, the tty device. It then loops like crazy looking for some input from somewhere, anywhere....

2 -- A user connected on a (noisy) dialup line loses his/her connection. The application, being reasonably well behaved, dies quietly. The shell script based menu doesn't notice that its tty device has gone away and loops looking for some input.....

Do either of these sound familiar to you?

If it's 1 -- there's not much you can do about that, apart from what you're doing now that is.

If it's 2 -- you can arrange it so that the shell script notices when a bad thing happens and exits nicely. Will show you how if you need it. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Hi
yes it's 2 ,happens to me.I use a script to kill that enoying users .I have one more question(sorry about that).I am not really good about scripts .Can i compile the script which i use to kill users cos i don't want to somone can change it.If i can how?My scipt is :

**********************
ps -ef -o pid,uname,command|sort +4n |grep $USER > $HOME/natlist.lst
cut -b 2-7 $HOME/natlist.lst>$HOME/natproc.lst
for i in `cat natproc.lst|awk ' {print $1}'`
do
echo "$i Has been killed!\n"
kill -9 $i
done


If i can hide that source i will put this script somewhere on my disk and i'll add to .profile of users as scipt path .When they get logoff they gonna run this script as well.That's my idea


Thank you for your helps

Regards

 
If, in your menu shell script, you include the command

trap HUP exit

The script will kill itself off when it receives the HUP signal -- when line noise forces a disconnect, for example.

From the Solaris man page

sh
The trap command argument is to be read and executed when the shell receives numeric or symbolic signal(s) (n). (Note: argument is scanned once when the trap is set and once when the trap is taken.) Trap commands are executed in order of signal number or corresponding symbolic names. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. An attempt to trap on signal 11 (memory fault) produces an error. If argument is absent all trap(s) n are reset to their original values. If argument is the null string this signal is ignored by the shell and by the commands it invokes. If n is 0 the command argument is executed on exit from the shell. The trap command with no arguments prints a list of commands associated with each signal number.

Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
hi again

I have tried that way but it doesn't work on my shell.It
turns with 'HUP not found'

I still use my script to kill that processes.

Anyway thanks for your help.

Regards
 
what shell are you using? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
hi

I am using ksh .I can run trap signals (1 ,15 ..) but HUP doesn't work.


 
That's ok then -- you can just trap the HUP signal using the number rather than its name. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
hi again

I 've already put users profiles " trap "" 2 3 5 15 " ,but the problem is in the .profile user calls another program which called natural.And if a user stucked or go exit abnormally while running on natural i can see them on cpu with maximum usage of cpu.

Thanks again.
 
Ok.

I thought it was the calling shell script (the .profile) that was spinning -- but it's the 'natural' process - is that right? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
here is a my sample .profile
If it's getting confusing for you don't worry about that please.


*********************************************
trap "" 2 3 5 15
if [ ! "$DT" ]; then
stty dec
tset -I -Q
fi
TERM=vt220
export TERM
PS1="`hostname`> "
MAIL=/usr/spool/mail/$USER
natural ::::::> natural is a main program which users are calls
. $HOME/eproc ::::> eproc is my scipt which user calls when get logoff
exit
****************************************

regards
 
try

trap 'exit' 2 3 5 15

natural will inherit the signal handler, unless it deliberately traps the sig itself Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
hi again

This is good idea but it would be dengerous for me because if i put this in the .profile thay can fall to command shell and they can use unix commands.





 
if you can get away without calling your ~/.eproc script you could call natural like this

exec natural

Then, when natural finishes - for whatever reason, the user *will* be logged out. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top