service tomcat start/stop 和 ./catalina.sh run/stop 有什么区别 [英] Whats the difference between service tomcat start/stop and ./catalina.sh run/stop

查看:32
本文介绍了service tomcat start/stop 和 ./catalina.sh run/stop 有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tomcat 或 TomEE 中的 service tomcat start/stop 和 ./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?

推荐答案

catalina.sh run 在前台启动 tomcat,在您启动它的控制台上显示日志.按 Ctrl-C 将终止 tomcat.

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 将在后台启动 tomcat.您必须 tail -f logs/catalina.out 才能查看日志.

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.

实际上,startup.sh 很小.如果您检查该文件,您会看到它依次调用 catalina.sh start.在 catalina.sh 中,您只需搜索 runstart 的出现,以查看它们处理方式的不同.

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 通常在 Linux(或 *nix)的后台启动一个守护进程,通过另一个(非 tomcat)操作系统脚本,例如在 /etc/init.d 中.它通常还负责运行 tomcat 作为特定用户(通常称为tomcat"或类似名称).如果您使用的是 Linux 发行版的 tomcat,您应该从这个脚本开始.否则,您将面临无法覆盖临时文件或日志文件的风险,因为它们属于您之前用来启动 tomcat 的不同用户.

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.

这篇关于service tomcat start/stop 和 ./catalina.sh run/stop 有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆