LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-17-2010, 06:10 AM   #1
ge_shekhar
LQ Newbie
 
Registered: Sep 2010
Posts: 16

Rep: Reputation: 0
Auto kill the applications


Hi,

I have some binaries runing on my server. I want to make a script to kill the binaries. Kindly help.


Regards
Shekhar
 
Old 09-17-2010, 06:12 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by ge_shekhar View Post
Hi,

I have some binaries runing on my server. I want to make a script to kill the binaries. Kindly help.


Regards
Shekhar
We can't do your homework. create script at your end and get back if any error/issue

BTW You can use kill and pkill command.

Code:
# kill signal PID
# pkill signal process name
signals
9=KILL
15=TERMINATE

for more signals

Code:
man 7 signal
Regards,

Last edited by sem007; 09-17-2010 at 06:14 AM. Reason: add more info
 
Old 09-17-2010, 06:25 AM   #3
ge_shekhar
LQ Newbie
 
Registered: Sep 2010
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks for information ,
now i can kill the application through process name using pkill command but how to get the exact process name of my application.
 
Old 09-17-2010, 06:27 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Thumbs up

Hi,
Get the name of binaries first

ps -ef | grep -i "binary name"

once you get the pid of that
kill it

kill -9 pid

or killall processname
 
Old 09-17-2010, 06:33 AM   #5
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
You can also use killall to kill all processes related to a certain name, like so:

Code:
killall -SEGV process_name
 
Old 09-17-2010, 06:33 AM   #6
ge_shekhar
LQ Newbie
 
Registered: Sep 2010
Posts: 16

Original Poster
Rep: Reputation: 0
Hi ,

This way using process id i am able to kill the applications but my main purpose was to automate it, instead of searching for PID and killing it, i just wanted to kill all the application in one go.
Eg. i have 4 applications runing.

1- a.sh
2- b.sh
3- c.sh
4 -d.sh

now i will write and application that will kill these 4 applications. i dont know service name of my applications when i try to get service name using pgrep -l a.sh then there is no output. please help.
 
Old 09-17-2010, 06:38 AM   #7
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Application or your service is shell script?
 
Old 09-17-2010, 06:50 AM   #8
ge_shekhar
LQ Newbie
 
Registered: Sep 2010
Posts: 16

Original Poster
Rep: Reputation: 0
Find below output of grep command for my application.

[root@imi dump]# ps aux|grep imiusr
root 8112 0.0 0.0 61160 744 pts/4 S+ 15:52 0:00 grep imiusr
root 12279 0.0 0.0 63844 1120 ? S Sep14 0:00 sh imiusr.sh
root 12280 0.0 1.2 1482284 103232 ? Sl Sep14 2:28 /usr/java/jdk1.6.0_18/bin/java -Xmx1024m -Djava.rmi.server.hostname=172.16.66.37 -jar /app/provisionmonitor/imiusr/libs/imiusr.jar /app/provisionmonitor/imiusr/config/imiusr.properties /app/provisionmonitor/imiusr/config/log4j.properties 9999


Now i want to kill this application by service name.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Kill?? BongFish Linux - Software 1 01-26-2009 07:30 PM
Auto-kill old threads? pixellany LQ Suggestions & Feedback 3 07-21-2008 10:54 AM
auto running applications Pytheas Linux - Software 3 06-19-2008 05:12 PM
How to Kill handed/crash applications AskMe Linux - Newbie 4 09-24-2003 01:30 PM
auto maximized applications in icewm matix Linux - Newbie 0 05-16-2003 09:12 PM


All times are GMT -5. The time now is 08:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration