how to start tomcat with `script -c` command?












0














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?










share|improve this question
























  • Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
    – dave_thompson_085
    Dec 2 at 15:54












  • I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
    – jacky
    Dec 2 at 16:15












  • @dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
    – jacky
    Dec 2 at 17:38










  • @dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
    – jacky
    Dec 2 at 17:45










  • Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
    – tink
    Dec 6 at 19:07
















0














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?










share|improve this question
























  • Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
    – dave_thompson_085
    Dec 2 at 15:54












  • I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
    – jacky
    Dec 2 at 16:15












  • @dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
    – jacky
    Dec 2 at 17:38










  • @dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
    – jacky
    Dec 2 at 17:45










  • Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
    – tink
    Dec 6 at 19:07














0












0








0







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?










share|improve this question















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?







linux bash tomcat






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 2 at 11:42









DavidPostill

103k25222256




103k25222256










asked Dec 2 at 10:56









jacky

12




12












  • Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
    – dave_thompson_085
    Dec 2 at 15:54












  • I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
    – jacky
    Dec 2 at 16:15












  • @dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
    – jacky
    Dec 2 at 17:38










  • @dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
    – jacky
    Dec 2 at 17:45










  • Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
    – tink
    Dec 6 at 19:07


















  • Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
    – dave_thompson_085
    Dec 2 at 15:54












  • I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
    – jacky
    Dec 2 at 16:15












  • @dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
    – jacky
    Dec 2 at 17:38










  • @dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
    – jacky
    Dec 2 at 17:45










  • Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
    – tink
    Dec 6 at 19:07
















Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
– dave_thompson_085
Dec 2 at 15:54






Note your first 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 the script 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 uses nohup to prevent this. Why do you need script anyway? normal tomcat shouldn't use the tty. If you just want to log the startup, path/startup.sh >logfile should be enough.
– dave_thompson_085
Dec 2 at 15:54














I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
– jacky
Dec 2 at 16:15






I've tried your test, after cancel the script, the tomcat is still running<br/>It is not a particular reason that I use script -ccommand to start tomcat, I just come across this trial and want to figure out the reason why script -c can't start a tomcat.<br>thanks,:)
– jacky
Dec 2 at 16:15














@dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
– jacky
Dec 2 at 17:38




@dave_thompson_085 Curiously, I try to add sleep to the command script -c "/usr/program/tomcat/tomcat-8.0.50/bin/startup.sh && sleep 1m" as you mentioned,the tomcat can be found in ps -ef,so as you said, the tomcat is actually started,but the pty hangup so the tomcat is shutdown.thanks again.
– jacky
Dec 2 at 17:38












@dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
– jacky
Dec 2 at 17:45




@dave_thompson_085 And I can also use nohup to start tomcat,script -c "nohup /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh",although the script command end,but the tomcat can be found in ps -ef
– jacky
Dec 2 at 17:45












Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
– tink
Dec 6 at 19:07




Is the sh in that script -c "sh /usr/program/tomcat/tomcat-8.0.50/bin/startup.sh"actually required? Ist the script not set executable?
– tink
Dec 6 at 19:07















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380163%2fhow-to-start-tomcat-with-script-c-command%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380163%2fhow-to-start-tomcat-with-script-c-command%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...