LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-15-2012, 11:56 PM   #1
lahirushanaka
Member
 
Registered: Oct 2012
Posts: 46

Rep: Reputation: Disabled
Question shell script for kill program and start progran


guy i need a help to write bash script to kill program. we are running jboss nodes, when i run ps -e|grep java then it show all running jave node with pid as 1234 java_n1 (this can be run java_n1,n2,n3...nn),

i want write script to identify how many nodes are running and kill them one by one using their pid number as "kill -9 1234". after kill them all need to check whether there are still java nodes are running, if not start previous available nodes after few seconds, ex- before kill the java process there was 10 node, after kill we have to start same 10 nodes.

please help me to write this.
 
Old 12-16-2012, 12:50 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
And what have you got so far? We are happy to help, but not to do the work for you.

May I start though by suggesting you have a look at the pgrep command.
 
  


Reply



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
Shell Script to start a program either not running or kill if running avataratar Linux - Newbie 1 03-29-2012 02:45 AM
Shell script to start another program, if not running. cooljai Linux - Software 13 03-13-2012 04:39 AM
Shell script to start program if not running 3lixy Linux - Software 4 08-07-2011 03:22 PM
How to use Shell script to kill an on going program? cruiz_bugs Programming 5 08-04-2009 08:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:10 AM.

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
Open Source Consulting | Domain Registration