Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between service tomcat start/stop and ./catalina.sh run/stop

Whats the difference between service tomcat start/stop and ./catalina.sh run/stop in Tomcat or TomEE?

Do they do exactly the same thing?

like image 590
Nahser Bakht Avatar asked May 01 '15 09:05

Nahser Bakht


People also ask

What is Catalina SH Tomcat?

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).

How do I know if Tomcat is running on my Mac?

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.

What happens when Tomcat server start?

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)

Is it possible to start/stop Tomcat server via command line?

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.

How do I start and stop a Catalina server?

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

What is service Tomcat start in Linux?

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).

How is Catalina invoked in Tomcat?

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.


1 Answers

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.

like image 76
Olaf Kock Avatar answered Oct 19 '22 04:10

Olaf Kock