supervisor 控制 tomcat 报 fatal Exited too quickly (process log may have details),求大神带飞!

2017-11-21 10:15:51 +08:00
 poupoo
ubantu 只装了 JRE
手动启动 tomcat 没问题
supervisor config 如下
[program:tomcat]
command=/home/dev01/mos/apache-tomcat-7.0.63/bin/startup.sh ; the program (relative uses PATH, can take args)
environment=HOME="/home/dev01/mos/apache-tomcat-7.0.63",USER="root" ;
directory=/home/dev01/mos/apache-tomcat-7.0.63;
autostart=true
autorestart=true
startsecs = 10
stopsignal = QUIT
stopasgroup = true
user = root
redirectstderr = true
redirect_stderr=true
stdout_logfile =/home/dev01/mos/apache-tomcat-7.0.63/logs/catalina.out ;
stdout_logfile_maxbytes=0


错误日志如下:
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT



supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
supervisor: child process was not spawned
12312 次点击
所在节点    问与答
14 条回复
poupoo
2017-11-21 10:17:15 +08:00
JRE 路径如:/home/dev01/jre1.7.0_45
laoyur
2017-11-21 10:40:30 +08:00
directory=/home/dev01/mos/apache-tomcat-7.0.63; // <---分号跟前面加一个空格
poupoo
2017-11-21 10:49:28 +08:00
@laoyur 改过了,依然是这个错,是不是一定要配置 jdk?
laoyur
2017-11-21 10:52:16 +08:00
> supervisor: couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63;: ENOENT
依然这个错?
都已经提示你 无法 change dir 到 xxx; 这个目录了,不是最后多了个分号么
你修改配置后有没有 supervisorctl update 啊?
poupoo
2017-11-21 11:10:17 +08:00
@laoyur 不报 couldn't chdir to /home/dev01/mos/apache-tomcat-7.0.63; 这个错,可还是 fatal Exited too quickly (process log may have details)
laoyur
2017-11-21 11:45:16 +08:00
看看 supervisord 的 log 去,log 的位置,是在 supervisord.conf 中配置的

我估计是找不到 JRE 吧,但我不懂 Java,是要在 PATH 中加入 JRE 的路径?

如果确实是因为 PATH 中没有包含 JRE 的路径,可以在 command 中这样写:
env PATH="/home/dev01/jre1.7.0_45:%(ENV_PATH)s" /home/dev01/mos/apache-tomcat-7.0.63/bin/startup.sh
GuuJiang
2017-11-21 12:38:36 +08:00
这是个很典型的问题啊,因为 start.sh 是创建新进程后台运行,而自身接着就退出了,这也正是你看到 Exited too quickly 的原因,解决方法,把命令中的 startup.sh 换成 catalina.sh run
lwldcr
2017-11-21 12:47:14 +08:00
不要让程序后台运行就好了 让它挂在前台

比如原本启用程序的时候:
./some_http_server &

改成:
./some_http_server

这样 supervisor 启动这个程序之后,能根据你的配置捕获它的异常退出状态码,并尝试重启
poupoo
2017-11-21 13:54:34 +08:00
@GuuJiang 确实改成 catalina.sh run 就 okay 了
poupoo
2017-11-21 13:55:13 +08:00
@lwldcr shell 不太懂,能不能说一下简单的机理
SoloCompany
2017-11-21 14:12:13 +08:00
excited
satifanie
2017-11-21 14:23:50 +08:00
改成 catalina.sh run 可以。但是还是不要用 Supervisor 来弄 tomcat 的。关闭的时候,你咋整。systemd 挺好的。
之前用 supervisor 我是参考的: https://gist.github.com/mariorez/d70ee9e8301eec783d0e
poupoo
2017-11-21 15:46:16 +08:00
@satifanie 您的意思是线程杀不死,还是?
satifanie
2017-11-21 15:57:35 +08:00
@poupoo 难道不应该友好的关闭程序。直接 KILL 太暴力了把。 万一有东西正在执行的话,也许是我多虑。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/408154

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX