Operating System - HP-UX
1845948 Members
2635 Online
110250 Solutions
New Discussion

Re: kill all login users script

 
SOLVED
Go to solution
Norman_21
Honored Contributor

kill all login users script

Hello everbody,
I wrote the following simple script to kill all login users
but when I run it states that the process id is not identified. Also, I need to filter the root account from that script, meaning I do not want the root to be killed.

PID='who -u|cut -c 45-49'
kill -9 $PID

please advise
apprecaite your support
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
4 REPLIES 4
Patrick Chim
Trusted Contributor
Solution

Re: kill all login users script

Hi,

You can use this,

PID=`who -u | grep -v root | awk '{print $7}'`
kill -9 $PID

However, it's not a good choice to use -9 unless the job has no response. I suggest you should use -15 or -TERM !

Regards,
Patrick
Yogeeraj_1
Honored Contributor

Re: kill all login users script

hi,

Have a look that this thread, where there are very good sysadmin scripts:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html

For you kill user script, this one will be ok as soon as you customise it:
http://forums.itrc.hp.com/cm/components/FileAttachment/0,,0x046350011d20d6118ff40090279cd0f9,00.txt

hope this helps!
Regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Norman_21
Honored Contributor

Re: kill all login users script

Thanks alot guys, it works fine. Sorry, for the delay it was just the weekend.

Thanks again.
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003
Norman_21
Honored Contributor

Re: kill all login users script

Closed...
"Attitudes are contagious, is yours worth catching"/ My first point was given by SEP on January 31, 2003