I want to start tomcat with the command:
script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"
After running the command, the console show the message that tomcat has started successfully.
But ps -ef | grep tomcat
shows that the tomcat doesn't start.
Then I try to use script
command without -c
option:
[root@xxx test]#script
Script started, file is typescript01
[root@xxx test]# sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh
Using CATALINA_BASE: /usr/program/tomcat/tomcat-8.0.50
Using CATALINA_HOME: /usr/program/tomcat/tomcat-8.0.50
Using CATALINA_TMPDIR: /usr/program/tomcat/tomcat-8.0.50/temp
Using JRE_HOME: /usr/program/java/jdk1.8.0_112
Using CLASSPATH: /usr/program/tomcat/tomcat-8.0.50/bin/bootstrap.jar:/usr/program/tomcat/tomcat-8.0.50/bin/tomcat-juli.jar
Tomcat started.
Then ps -ef | grep tomcat
shows the tomcat is started.
How can I start tomcat with script -c
?
ps
doesn't prove tomcat didn't start, only that it didn't remain running, which is different. For the interactive case if you end thescript
subshell (control-D, exit, or logout) does tomcat remain running then? If not it could be dying because of the pty 'hangup', although that should only happen if you or someone changed the config because the default config usesnohup
to prevent this. Why do you needscript
anyway? normal tomcat shouldn't use the tty. If you just want to log the startup,path/startup.sh >logfile
should be enough.script
, the tomcat is still running<br/>It is not a particular reason that I usescript -c
command to start tomcat, I just come across this trial and want to figure out the reason whyscript -c
can't start a tomcat.<br>thanks,:)sleep
to the commandscript -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m"
as you mentioned,the tomcat can be found inps -ef
,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"
,although thescript
command end,but the tomcat can be found inps -ef
sh
in thatscript -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"
actually required? Ist the script not set executable?