- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- fuser -ku /dev/pts/0 command does not wok
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
01-14-2007 10:18 PM
01-14-2007 10:18 PM
fuser -ku /dev/pts/0 command does not wok
I have a cron job that will kill users that are active for 24 hours. My cron job contains fuser -ku "/dev/pts/0". I noticed that after the cron has ran, the user with pts/0 is still present in "who" command. when I manually ran the script, the user is killed. Is it normal for fuser -ku command to work only after 2nd and 3rd execution?
regards,
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 10:33 PM
01-14-2007 10:33 PM
Re: fuser -ku /dev/pts/0 command does not wok
the fuser -k sends a kill -9 level, which terminates the process without caring about the niceities, such as cleaning up the utmp and wtmp files.
This is were this problem can arise from.
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
So far you have never awarded any points !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 10:42 PM
01-14-2007 10:42 PM
Re: fuser -ku /dev/pts/0 command does not wok
I also have similar script working for last
6 years.
Sometime at command line
fuser -ku
won't kill if login is "old".
Pl. give details of ur script.
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 10:45 PM
01-14-2007 10:45 PM
Re: fuser -ku /dev/pts/0 command does not wok
thanks for providing the procedure on how to award points. :)
But is it ok to re-run the fuser -ku /dev/pts/0 until its killed? 2 to 3 times?
regards,
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 10:52 PM
01-14-2007 10:52 PM
Re: fuser -ku /dev/pts/0 command does not wok
My script will grep for users with "rp" and redirected to a /tmp/file. Then it will check for the login time. If the login time is equal to a specific value that translates to 24 hours, the /pts/0 (for ex.) will be killed using the fuser -ku "/dev/pts/0". This script will be run using cron twice daily. Sometimes the user was killed sometimes its not.
regards,
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 11:25 PM
01-14-2007 11:25 PM
Re: fuser -ku /dev/pts/0 command does not wok
Have u tested the script, i.e. login to
a terminal and keep it idle for some time
set in ur script values for this test session
and run script manually,
insert set -vx at the beginning of ur script
this will show debugging info. of ur script.
Go through script attached herewith which
I use to run since last 6 years without
any problem. Which Warns and then kills the
terminals.
Regards.
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 11:31 PM
01-14-2007 11:31 PM
Re: fuser -ku /dev/pts/0 command does not wok
Againing uploading it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2007 11:34 PM
01-14-2007 11:34 PM
Re: fuser -ku /dev/pts/0 command does not wok
Copying here the contents.
--------------------------------
## Extracts logged-in terminals .
for Term in `who -u|cut -c 12-20`
do
## To get idle time of given terminal .
Idle=`who -u|grep $Term|cut -c 41-42`
## To get login name of given terminal .
Log=`who -u|grep $Term|cut -c 1-10`
## To get LTS of given terminal .
lts=`who -u|grep $Term|cut -c 15`
## If login is not csms or mtnlbckp or LTS is not P and idle time is
## more than 10 minutes then sends warning message to that terminal .
if [ \( $Idle -gt 10 -a $Idle -le 25 \) -a ! \( $Log = csms -o $Log = ccbs -o $Log = oracle -o $lts = p -o $Term = console -o $Term = ttytf -o $Term = ttyt6 -o $Term = ttys3 -o $Term = ttyv5 -o $Term = ttyvc \) ]
then
alm=1
## Sends Audible Alarm to idle terminal .
while [ $alm -lt 5 ]
do
echo "\a\c" > /dev/$Term ## Sends Alarm
sleep 1
alm=`expr $alm + 1`
done
## Sends message to idle terminal .
echo "\n\t\t\t`date`" >/dev/$Term
echo "\n\t\033[5mYou are not using the system for last $Idle minutes , press
## Saves details to logfile idle.log .
echo "\n`date`\nUser $Log at $Term is idle for $Idle minutes !">> /Mi_cron/cron_log/Idle.log
fi
## Terminates the terminal if it is idle more than specified time after
## warning .
if [ $Idle -gt 25 -a ! \( $Log = csms -o $Log = ccbs -o $Log = oracle -o $lts = p -o $Term = console -o $Term = ttytf -o $Term = ttyt6 -o $Term = ttys3 -o $Term = ttyv5 -o $Term = ttyvc \) ]
then
## Terminates the terminal .
/usr/sbin/fuser -ku /dev/$Term > /Mi_cron/cron_log/Process.log
## Saves details in logfile kill.log .
echo "\n`date`\nUser $Log at $Term idle for $Idle minutes, terminated !">> /Mi_cron/cron_log/Kill.log
fi
done
--------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2007 05:24 PM
01-15-2007 05:24 PM
Re: fuser -ku /dev/pts/0 command does not wok
Thanks for the sample script. My script is actually running fine. I think the problem is with the fuser command. Sometimes the user is get killed on the first run of the script sometimes on the second run.
regards,
chris