Mahesh Dwarapureddi wrote:Because am running in automtion suite for some requirements by using shell script. Automation.sh
That script will start the gwr server, at the end it should automatically kills the process. That is the reason I should not use PID, because every time PID get changed for each run
Mahesh Dwarapureddi wrote:am using ubuntu,
Yes I want to kill process every time for all process running with the name gwr.
I wanted to kill whatever process running with gwr name. that is my requirement.
Please suggest is there any other ways.
Tim Holloway wrote:Not sure if the third item above means use "inetd/xinetd" or not. That's a good approach for lightweight servers, but the inetd daemon launches a new copy of the server for every connection, so heavyweight services such as Apache or anything running in a JVM are not a good fit - too much work to start up a new instance over and over again.
Putting something in a VM and terminating the VM doesn't actually shut the server cleanly because the guest OS will do a kill -9 on anything that it cannot persuade to shut itself down. Yes, if you're using a snapshot system image, you won't be left with corrupted disk or RAM, but it's still a brutal solution and it doesn't actually address what other machines in the system would have to do if the server dropped out.
Winston Gutkowski wrote:
But it will do it according to the rules laid out by the shutdown command, which is a tried and tested method for shutting down machines, and which I'm pretty sure (unless things have changed a lot since I was admin-ing) tries a SIGHUP first and allows a certain amount of time for processes to terminate, before doing a SIGKILL. Indeed, it might even try more than one signal type (eg, SIGINT, SIGQUIT...).
Tim Holloway wrote:It may be that a JVM catches SIGHUP (I haven't checked in a while), but that would only ensure the clean shutdown of the JVM itself at best. The JVM would be forcibly killing the application threads, so the real dirty stuff still applies.
Richard Tookey wrote:Have I missed something? I see no mention by the OP that his 'gwr' process is Java related.
Richard Tookey wrote:... since he gives every indication that he is happy with just killing the process I have to assume that it is safe.