Hi.
I have not followe3d this thread since the beginning, but
The standard tomcat distribution comes with a series of shell scripts in the "bin"
directory, which do just that : start or stop tomcat. They are conveniently called
"startup.sh" and "shutdown.sh". You could get inspiration from those.
Since you are talking about bash, it is to be presumed that you are on a Linux system.
If this Linux system has a package management system, it is very likely that there is a
tomcat package available. Such tomcat packages come with startup and stop scripts for
tomcat, which make it easy to start/stop tomcat via a shell command.
Furthermore, look at the on-line documentation. In
http://tomcat.apache.org/tomcat-9.0-doc/config/server.html#Common_Attributes, you will
find the "shutdown" attribute and its explanation. It basically means that if you open a
TCP/IP socket to the given port (which you can do with bash), and send the indicated
string on that connection, tomcat will initiate a shutdown.
And that's in fact what the standard shutdown.sh does, though using a roundabout way : it
starts another java jvm instance which runs another temporary instance of tomcat, which
just does one thing : send this shutdown string to the appropriate (main instance of
tomcat's) shutdown port (and then it shuts itself down).
So it looks like there are a lot of ways to achieve what you want, and you only need to
pick the right one for you.
Post by Luis RodrÃguez FernándezHello Danesh
Perhaps you could look for any of your tomcat connector ports, ask for the
$ ppid=`lsof -i:8080 -Fp | grep p`
$ pid=`echo ${ppid#p*}`
$ kill $pid
Probably you can find something more elegant but the idea could be this
one...
Hope it helps,
Luis
Post by Leon Rosenberguse -force option
bin/shutdown.sh -force
regards
Leon
Post by dhanesh1212121212Hi All,
Trying to stop and start tomcat in production using bash script for war
deployment.
If tomcat not stopped properly then how we can kill the correct process
and
Post by dhanesh1212121212make sure it's stopped correctly.
Regards,
Dhanesh M.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org