-
1. Re: jboss 4.0.4 shutdown by kill -9 pid
nobleman1997 May 6, 2010 2:59 PM (in response to nobleman1997)somebody suggested that i should use JAVA_OPTS="$JAVA_OPTS -Djboss.aop.verbose=true" in run.sh. I tried but still it doesn't show up in log when it is killed.
-
2. Re: jboss 4.0.4 shutdown by kill -9 pid
cullendw May 6, 2010 4:01 PM (in response to nobleman1997)Is there any reason why are you not using the standard jboss shutdown script? Kill -9 will terminate the process on an OS level, so jboss will not log anything. I think you can somehow catch a kill signal (not a -9 though) and cause a graceful shutdown. Also look at adding a Runtime.addShutdownHook.
-
3. Re: jboss 4.0.4 shutdown by kill -9 pid
nobleman1997 May 6, 2010 5:22 PM (in response to cullendw)Thanks Danial for reply. I do have shutdown script but in production some times jboss goes down for some reason and there is no log how it went down. Probably somebody might have killed the process accidentally. I want to find out reason why it goes down in future. So if i can log it in server.log if it is killed by using such command or something.
-
4. Re: jboss 4.0.4 shutdown by kill -9 pid
dmlloyd May 6, 2010 5:25 PM (in response to nobleman1997)Never use kill -9 to shut down an app server. At the OS level, this terminates the process immediately - thus nothing is given the chance to shut down and clean up resources. Transactions can be left unresolved; files left partially written. This is a bad, bad practice. If you use SIGTERM or SIGINT to shut down JBossAS, it will shut down correctly and the information will be in the log properly. Using the shutdown script effectively works the same way as delivering a SIGINT to the process.
-
5. Re: jboss 4.0.4 shutdown by kill -9 pid
nobleman1997 May 6, 2010 6:18 PM (in response to dmlloyd)Thanks David for your input. I agree with you that we should not use kill -9. But in out prod system, since jboss goes down some times and never have log of it. If it is shutdown by script than it shows log. So if somebody stop the process by some means and we don't know what is happening why jboss is going down. I want to keep tack of how it went down. Any suggestions ?
-
6. Re: jboss 4.0.4 shutdown by kill -9 pid
rouvas May 6, 2010 6:37 PM (in response to nobleman1997)If you have people that can arbirtarily kill process in your server, you have more serious problems than keeping a log of when the server went down.
Having said that, check out the documentation of the "trap" command (provided by bash if you're on Linux) or by the shell.
.e.g, to disallow shutting down by kill:
trap "" 2 15 18 # Ignore SIGINT, SIGTERM and SIGTSTP
this has to be inserted in run.sh.
Be very carefull with that stuff, they bite.
-Stathis
-
7. Re: jboss 4.0.4 shutdown by kill -9 pid
cullendw May 7, 2010 1:47 AM (in response to rouvas)I agree with Stathis and the previous replies, you should not have people arbitrarily killing your jboss instance. Have a relook at your security model.
As another alternative (since we are already getting out of hand ...) :
create a script called "kill.sh". In this script, you can log what's happening, send a mail or do whatever you need to do when the kill command is executed.
You then set up an alias of kill to kill.sh. So every time someone issues a kill command, your script gets invoked and logs / notfies before issuing the kill command.
Example :
in my kill.sh script
echo "Killing ..."kill $@I then set up an alias in my .bashrc :
alias kill='/path/kill.sh"
now every time you call 'kill' you will see an output "Killing ...". As mentioned previously you can extend this and mail/ log to file etc.