![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| kill(0,-9) don't kill the process | umen | High Level Programming | 9 | 06-19-2007 03:09 AM |
| how to start a process and make it sleep for 5 mins and then kill that process | shrao | Shell Programming and Scripting | 6 | 03-27-2007 09:54 AM |
| When kill doesnt work, how to kill a process ? | VijayHegde | UNIX for Advanced & Expert Users | 3 | 05-12-2006 01:24 PM |
| how to kill process from file | naamas03 | Post Here to Contact Site Administrators and Moderators | 1 | 09-16-2005 05:03 AM |
| who -uH, kill the process at different pts/tb | yls177 | UNIX for Dummies Questions & Answers | 3 | 12-11-2002 06:32 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
i have a script that read a file which contains process_id and time that he's
in and it lookes like this 0:30 54545 0:44 66788 0:90 23233 i need to read every line in the file and get the time and if the process is greater then 0:30 to kill the process id the script looks like this cat bbb | while read line do #kill -9 $i done i don't how to take of the hour , ask about it and kill the process can you please help me and another question did i do the loop ok did i need the pipe before the while |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Your loops looks fine - you need to separate out the processID from the time; there's a couple different ways to do it. the easiest is with 'cut'.
Code:
proc=`echo $i | cut -f2 -d" "` kill -9 $proc |
|
#3
|
||||
|
||||
|
Code:
#!/usr/bin/ksh IFS='[ :<tab>]' while read a b pid; do [[ $a$b -gt 30 ]] && kill $pid done < bbb Last edited by reborg; 09-15-2005 at 05:11 PM. |
|
#4
|
|||
|
|||
|
Quote:
i need to ask about the time too if it's greater then 30 minutes and the take of the process and kill it the name of my file is bbb can you please help me thanks a lot |
|
#5
|
||||
|
||||
|
Quote:
|
|
#6
|
|||
|
|||
|
Quote:
can someone please help me |
|
#7
|
||||
|
||||
|
Yes, if you explained a bit more clearly where you are having problems.
|
||||
| Google The UNIX and Linux Forums |