HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script wanted about user login
Operating System - HP-UX
1833019
Members
2152
Online
110048
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
06-23-2004 01:33 PM
06-23-2004 01:33 PM
I want to control the no. of user login , the max. of login is limited to 300 , but it always over 300 logins at the peak hour , so I want to kill five users who are idle for most long time because I want to remain the no. of login to 295 , can suggest how to write the shell script ? thx.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2004 02:24 PM
06-23-2004 02:24 PM
Solution
If they have shell access, you can add the shell variable 'TMOUT' to each one. The sh-posix man page has details.
You could as an alternative use another method, and that is add some lines of code to the /etc/profile file, where it evaluates the number of users logged in, and if there are 300 already, it will log them out.
This post should help
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=534189
You could as an alternative use another method, and that is add some lines of code to the /etc/profile file, where it evaluates the number of users logged in, and if there are 300 already, it will log them out.
This post should help
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=534189
Anyone for a Mutiny ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2004 04:16 PM
06-23-2004 04:16 PM
Re: script wanted about user login
thx Michael's reply,
I find the script that u provide , it will kill the idle process that idle over a certain time , but I want a script that is more intelligence , it can kill the logins their idle time are the most long in the system , do anyone have such script ? thx.
I find the script that u provide , it will kill the idle process that idle over a certain time , but I want a script that is more intelligence , it can kill the logins their idle time are the most long in the system , do anyone have such script ? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2004 04:45 PM
06-23-2004 04:45 PM
Re: script wanted about user login
hai,
We can get the idle time of users with who -u or w command.
#!/usr/bin/ksh
# user login control
max=300
while true; do
cnt=`who -R | wc -l`
kill_cnt=$(($cnt-$max+5))
loop=0
while [[ $loop -lt $kill_cnt ]]; do
# send the mail to ip-address
echo "you are being idle" > mail `who -Ru | sort -k 6 | tail -1 | awk '{ print $8 }'`
# kill them
kill -9 `who -Ru | sort -k 6 | tail -1 | awk '{ print $7 }'`
let loop=loop+1
done
# Sleep for some time to synchronize
sleep 120
done
It will check and kill the exceeding users
Regards,
Muthukumar.
We can get the idle time of users with who -u or w command.
#!/usr/bin/ksh
# user login control
max=300
while true; do
cnt=`who -R | wc -l`
kill_cnt=$(($cnt-$max+5))
loop=0
while [[ $loop -lt $kill_cnt ]]; do
# send the mail to ip-address
echo "you are being idle" > mail `who -Ru | sort -k 6 | tail -1 | awk '{ print $8 }'`
# kill them
kill -9 `who -Ru | sort -k 6 | tail -1 | awk '{ print $7 }'`
let loop=loop+1
done
# Sleep for some time to synchronize
sleep 120
done
It will check and kill the exceeding users
Regards,
Muthukumar.
Easy to suggest when don't know about the problem!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP