- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script wanted
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 09:14 PM
05-24-2004 09:14 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 09:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 09:39 PM
05-24-2004 09:39 PM
Re: Script wanted
TMOUT=1800
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 10:04 PM
05-24-2004 10:04 PM
Re: Script wanted
Below script will kill those users who are idle between 31 to 59 minutes. Save it and run this. You can run it from cron.
!/usr/bin/sh
who -u |grep -v EDI| cut -c 1-10,39-50| grep -e ":[3-5][1-9]" > current
for i in `cat current | awk '{print $3}'`
do
kill -9 $i
done
Regards
Tapa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 11:07 PM
05-24-2004 11:07 PM
Re: Script wanted
I'd suggest either putting in lots of checks to make sure you're killing what you think you are killing or, as mentioned above, use "TMOUT".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2004 11:10 PM
05-24-2004 11:10 PM
Re: Script wanted
Sorry, but I'm not sure that this is correct to kill users' sessions, even if the sessions are not active. If this doesn't overload computer, let them live, change the kernel parametres, which limit number of users and forget about the problem.
But if you want to do this in any case, so
who -T | sed 's/://' |
awk '$7=="old"||$7>30 {system("kill -9 " $(NF-1)}'
Good luck and prepare to talk with angry users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2004 01:27 AM
05-25-2004 01:27 AM
Re: Script wanted
I am with Victor,
IMHO you will spend much more time and resources hunting down idle session, checking them, killing them, then you'll ever save by not having them.
And any user reconnecting subsequently, will blow away the 'gains', not to mention the aggravation caused.
Idle process killers are only usefull if there is a serious non-replennishable resource to be protected. In the old days that used to be MODEM lines.
Nowadays, just increase nproc, network ports and the likes!
If you do feel you need to have an idle process killer (maybe because you are really-really tight on memory and swap, or maybe to give a (false!) sense of security towards management) then set the timeout to a day or two please!
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 01:23 AM
05-26-2004 01:23 AM
Re: Script wanted
When we were running into problems we bumped "inactive" users after 2 hours and gad you'd think we were Saddam's sons putting cigarettes in peoples eyes.
Our biggest call volume on the helpdesk is when people can't get into the system.. We got the tty issue fixed quickly.
Make sure your licensing # is enough to handle a consistent load.
For a while you may want to run the script below to log the usercount and watch your peaks and valleys. It helped us reduce licensing from 250 to 100. Cutting our yearly support fee by boocoo bucks.
#ROOT CRONTAB
* 4-22 * * * /usr/local/bin/monitor/usercount
55 5 * * * /usr/local/bin/monitor/dailycount
# more usercount
export whoson=`who|wc -l`
# echo $whoson `date +%D` `date +%T` >>/tmp/usercount.log
if [ "$whoson" = [0-9] ]
then
echo "0$whoson" `date +%D` `date +%T` >>/tmp/usercount.log
else
echo "$whoson" `date +%D` `date +%T` >> /tmp/usercount.log
fi
# more dailycount
sort -n /tmp/usercount.log |tail -1 >> /tmp/dailycount.log
mv /tmp/usercount.log /home/backup/monitor/usercount`date +%m%d%y`.log
Just a thought or two..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2004 04:11 PM
05-27-2004 04:11 PM
Re: Script wanted
I tried the script , it is Ok , but if I want the EDP users can't be killed by the script , what can I do ? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 10:49 PM
06-03-2004 10:49 PM
Re: Script wanted
I tried your script , it is work , but if I want to find the idle time over 60 minutes , how to do it ? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2004 10:58 PM
06-03-2004 10:58 PM
Re: Script wanted
It's an good idea to use TMOUT variable in the .profile file of users except which belongs to EDP user. That way it would be easy and harmless.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2004 02:20 PM
06-09-2004 02:20 PM
Re: Script wanted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2004 06:47 PM
06-09-2004 06:47 PM
Re: Script wanted
Put it in /etc/profile and everyone gets it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2004 07:10 PM
06-09-2004 07:10 PM
Re: Script wanted
I test TMOUT is fine , but if I want it only apply to non EDP user , who can I do ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2004 07:28 PM
06-09-2004 07:28 PM
Re: Script wanted
case $LOGNAME in
EDP*)
TMOUT=1800
;;
esac