Script to kill rsh processes running for more than 10 mins


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to kill rsh processes running for more than 10 mins
# 1  
Old 06-27-2006
Error 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  
Old 06-27-2006
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  
Old 07-04-2006
Thanks a lot it helped... Smilie
# 4  
Old 07-04-2006
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to kill a process running at a certain port

Hello, I have multiple scripts (vlc1, vlc2,...vlc5) and as I do not know how to run them as upstart processes, I entered my script links into rc.local file. Here is the sample one for process vlc1: $ nano /etc/rc.local added below line into rc.local /var/bin/./vlc1 & Port nr of vlc1... (7 Replies)
Discussion started by: baris35
7 Replies

2. Shell Programming and Scripting

Websphere Running processes script

Hello experts, I'm trying to run a script that checks the processes listed and returns their name and their PIDs. #!/bin/bash PROCS="DMgr BPM.AppTarget BPM.Support BPM.WebApp BPM.Messaging nodeagent App.Messaging " for p in $PROCS do PROCEXIST=$(ps aux | grep $p | grep -v grep) ... (3 Replies)
Discussion started by: KingaKoopa
3 Replies

3. Shell Programming and Scripting

script to kill tail processes

my unix machine is currently shared by many teams, because of that lots of processess are running and bad part is taht when I do psu ...i can see all tail processes as well , meaning ppl who have viewed files with tail and have forgotten to close it. command prompt >> psu tail -n 0 -f... (2 Replies)
Discussion started by: mitsyjohn
2 Replies

4. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (5 Replies)
Discussion started by: Ikebana
5 Replies

5. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (2 Replies)
Discussion started by: Ikebana
2 Replies

6. UNIX for Dummies Questions & Answers

script to kill related processes

hi guys, can anyone help me out with the script to kill all the related process at once. i have something like below ps -fu UID PID PPID C STIME TTY TIME CMD xyz 17398 1 2 Dec30 ? 00:31:20 ./psa_mux -simulate -client_ports 22000 xyz 17399 1 2... (2 Replies)
Discussion started by: smithaph
2 Replies

7. Shell Programming and Scripting

running multiple rsh command in a script

hi scripting experts, juz wondering if it's possible to have multiple rsh command in a single script? :confused: ie: rsh -l <username> "<command>" rsh -l <username> "<command>" thanks. regards, wee :) (0 Replies)
Discussion started by: lweegp
0 Replies

8. Shell Programming and Scripting

script to kill rsh processes running for more than 10 minutes

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 (1 Reply)
Discussion started by: amitsayshii
1 Replies

9. UNIX for Advanced & Expert Users

script to kill rsh processes running for more than 10 minutes

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 (1 Reply)
Discussion started by: amitsayshii
1 Replies

10. Shell Programming and Scripting

Need a script to kill processes with PPID of 1

Hi, I have been trying to come up with a script to run as a cron job to kill any processes that have PPID of 1. I have created a file that contains the PID and the PPID. How can I read this file and then execute a kill on any PID where PPID is 1. The file looks like this: 4904 1 4455 1... (5 Replies)
Discussion started by: lbaysdon
5 Replies
Login or Register to Ask a Question