Script to kill the specific process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to kill the specific process
# 1  
Old 07-29-2010
Data Script to kill the specific process

Hi

I have the process to kill regulary, but the PSID is dymatic change and not sure how to kill the specific process ID

Check the tradekast_rvd is running , if such process, kill the els process id

Code:
ps -e f |grep tradekast_rvd 
 
ps -ef |grep els

then I kill els process id

CODE
Code:
Processid=2404
if   ps -e f |grep tradekast_rvd   
then 
ps -ef | grep els ; kill$
else
echo " No such Process
 
end if

What is another way to do the script ?

Thank you

Last edited by pludi; 07-30-2010 at 02:03 AM..
# 2  
Old 07-29-2010
ps -ae | awk '/els/ {print $1}' | xargs kill

I'd use that line to kill els
# 3  
Old 07-30-2010
Thank your reply

I check it. thanksSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture process id and kill that via script

Dear Experts , we have a script scheduled on daily basis , cd /u01/oracle/inst/apps/PROD_prodapps/admin/scripts/ ./adstpall.sh apps/apps echo " " echo " " echo " " ps -ef | grep FND pkill -9 FND ps -ef | grep FND pkill -9 FND ps -ef | grep FND but even then there are some... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

2. Shell Programming and Scripting

Help with kill a specific process after certain running time

Hi, Do anybody experience to write a bash script in order to kill a specific process (java) after certain time of running? eg. java java.jar task_run.txt I will run a java program (java.jar) which will run a long list of process (task_run.txt) one by one. I plan to terminate the java... (5 Replies)
Discussion started by: perl_beginner
5 Replies

3. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

4. Shell Programming and Scripting

Script does not kill the java process

Hi We have script to stop our application, all our application use this standard script to stop however in one of our application this script does not work properly. It does not kill the process, thats why we always use the manual process to kill which is to kill the process id (kill -9... (1 Reply)
Discussion started by: kaibiganmi
1 Replies

5. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

6. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

7. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

8. AIX

Kill IDLE Process using script !!!

Dear Friends , I am using DB2 database in AIX 5.3 server . In my server some IDLE process are generated after several times which I need to kill it manually each and every time . The process I query like following : root@bagpuss $ ps auxw|sort -r +3|head -10 USER PID %CPU %MEM ... (3 Replies)
Discussion started by: shipon_97
3 Replies

9. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

10. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies
Login or Register to Ask a Question