script to kill tail processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to kill tail processes
# 1  
Old 04-25-2011
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 /x/y/filename.csv
.
.
.
.
.
tail -n 0 -f /x/y/filename.csv(lots of tail files)

how can i write a script to only kill the tail processes.

thanks for looking into it
# 2  
Old 04-25-2011
Code:
pgrep tail | kill -9

# 3  
Old 04-25-2011
Quote:
Originally Posted by kevintse
Code:
pgrep tail | kill -9

Your kill reads pids from standard input? I think most would have to use command substitution to pass the pgrep output to kill as command line arguments.

On an unrelated note, if pgrep is available, it's very likely that so is pkill. In which case, pkill can be used directly.

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

kill multiple processes by name

Want to kill multiple processes by name. for the example below, I want to kill all 'proxy-stagerd_copy' processes. I tried this but didn't work: >> ps -ef|grep proxy_copy root 991 986 0 14:45:34 ? 0:04 proxy-stagerd root 1003 991 0 14:45:49 ? 0:01... (2 Replies)
Discussion started by: catalinawinemxr
2 Replies

2. Shell Programming and Scripting

need to kill a number of processes with name "XYZ" at a time using shell script

Hi, when i grep for the process "XYZ" , there will be some good number of processes with that name, i want to kill all the these processes at a time using shell script? Any help needed for this action. Thanks Regards, Anil (6 Replies)
Discussion started by: anilmanepu
6 Replies

3. Shell Programming and Scripting

Kill processes

for i in 'ps -f | grep textedit' do kill $i done I wrote this but it wont work. I am trying to find processes and kill them. Any help would be welcome. (1 Reply)
Discussion started by: hawaiifiver
1 Replies

4. 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

5. Solaris

kill processes

how to kill the processes of aperticular user? because i have nearly 25000 process are there for perticular user. i need to kill. Please provide the information? Regards, Rajesh (3 Replies)
Discussion started by: pmrajesh21
3 Replies

6. Shell Programming and Scripting

kill all processes

i have a very short file that has in it a line for a find command. now, when i run this script and I kill the script later, using the ps -ef | grep scriptname. i noticed kill -9 kills the script itself but does not kill the internal find command that it gave birth to. say theres a file... (0 Replies)
Discussion started by: Terrible
0 Replies

7. UNIX for Dummies Questions & Answers

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