Whats the difference between service tomcat start/stop and ./catalina.sh run/stop in Tomcat or TomEE?
Do they do exactly the same thing?
sh". For Windows users, these scripts are included as batch files, with the extension "bat". "Catalina" is the script that is actually responsible for starting Tomcat; the "startup" script simply runs "catalina" with the argument "start" ("catalina" also can be used with the "stop" parameter to shut down Tomcat).
Use a browser to check whether Tomcat is running on URL http://localhost:8080 , where 8080 is the Tomcat port specified in conf/server. xml. If Tomcat is running properly and you specified the correct port, the browser displays the Tomcat homepage.
the file gets compiled into target/classes. upon publish the file gets copied to the deployment folder. Tomcat notices that a class file was changed and reloads the context (i.e. web application is restarted)
In fact, Tomcat is often run on blade servers that may not even have an active monitor connected to them. Windows Services are owned by the System, and can be started without an active user. Recently I wanted to start/stop my Tomcat Server via command line as wanted to create quick shall script to do it.
To Stop server: <Tomcat Root>/bin> catalina.bat stop 3) Mac/Linux/Unix (if you have downloaded binaries as.zip) To Start server: <Tomcat Root>/bin>./catalina.sh start To Stop server: <Tomcat Root>/bin>./catalina.sh stop
service tomcat startis typically starting a daemon in the background on Linux (or *nix), through yet another (non-tomcat) OS-script e.g. in /etc/init.d. It typically also takes care of running tomcat as a specific user(often called "tomcat" or similar).
The main script, catalina, is invoked with one of several arguments. The most common arguments are start, run, or stop. When invoked with start(as it is when called from startup), it starts up Tomcat with the standard output and standard error streams directed into the file CATALINA_HOME/logs/catalina.out.
catalina.sh run
starts tomcat in the foreground, displaying the logs on the console that you started it. Hitting Ctrl-C will terminate tomcat.
startup.sh
will start tomcat in the background. You'll have to tail -f logs/catalina.out
to see the logs.
Both will do the same things, apart from the foreground/background distinction.
Actually, startup.sh
is quite small. If you inspect the file, you'll see that it in turn calls catalina.sh start
. And in catalina.sh
you can just search for occurrences of run and start in order to see the difference in how they're handled.
service tomcat start
is typically starting a daemon in the background on Linux (or *nix), through yet another (non-tomcat) OS-script e.g. in /etc/init.d
. It typically also takes care of running tomcat as a specific user (often called "tomcat" or similar). If you're using your Linux-distribution's tomcat, you should only start with this script. Otherwise you're risking that temporary files or log files can't be overwritten, because they belong to a different user that you used to start tomcat with earlier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With