The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to check running processes on remote server. amitsayshii Shell Programming and Scripting 5 10-06-2006 04:43 AM
script to kill rsh processes running for more than 10 minutes amitsayshii Shell Programming and Scripting 1 06-27-2006 11:12 AM
script to kill rsh processes running for more than 10 minutes amitsayshii UNIX for Advanced & Expert Users 1 06-27-2006 11:07 AM
Kill Processes Running On a Particular Port mahatma UNIX for Advanced & Expert Users 7 03-20-2006 07:50 AM
Need a script to kill processes with PPID of 1 lbaysdon Shell Programming and Scripting 5 04-13-2005 01:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-27-2006
amitsayshii amitsayshii is offline
Registered User
  
 

Join Date: Jun 2006
Location: JHB
Posts: 18
Exclamation Script to kill rsh processes running for more than 10 mins

Hi Friends,

I need to write a script to kill some processes running for more than 10 minutes. Can I get some pointers on that. Thanks for ur help in Advance.

Thanks&Regards,
Amit
  #2 (permalink)  
Old 06-27-2006
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
Try this:
Code:
#!/bin/ksh
who -u > ./aaa
#cutting the position of the hour
cut -c 39-49 ./aaa > ./bbb
grep ":" ./bbb > ./ccc
IFS='[: ]'
while read a b pid;
do
if [ $a+0 -gt 0 ] || [ $b+0 -gt 10 ]; then
kill $pid
fi
done < ccc
This kills the idle users, you can get idea from this.

Regards,
Tayyab
  #3 (permalink)  
Old 07-04-2006
amitsayshii amitsayshii is offline
Registered User
  
 

Join Date: Jun 2006
Location: JHB
Posts: 18
Thanks a lot it helped...
  #4 (permalink)  
Old 07-04-2006
pressy's Avatar
pressy pressy is offline Forum Staff  
solaris cultist
  
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 726
you could set a variable in the userprofiles called TMOUT, shell will timeout in $TMOUT seconds due to inactivity and will close the session...

TMOUT is supported by bash, ksh, and some other shells...

gP
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0