On Friday, Sep 24, 2004, at 13:08 Europe/London, Martijn Koster wrote:
On Fri, 2004-09-24 at 12:59, Richard Lewis wrote:
Hello ALUG,
I'm trying to write an init script to get Tomcat (4.1) to start at boot. (On Debian).
I've created a file: /var/webapps/tomcat/bin/tomcat.sh =====================================
export TOMCAT_BIN=/var/webapps/tomcat/bin
Try adding:
#!/bin/sh
D'oh!
OK, thanks for that - it now picks up tomcat.sh and the daemon starts fine.
I've just found one more problem though: it won't stop!!
# /etc/init.d/tomcat stop doesn't return any errors but I had a look and found that the directory /var/run/tomcat was empty; it seems its left no process id file. Is this why it can't stop?
Also, # ps -Al inclues: 0 S 103 5156 1 4 85 0 - 77414 schedu pts/0 00:00:21 java
which must be the tomcat process. Might it be confused because the process is called 'java' not 'tomcat'?
Thanks for any help.
Cheers, Richard
On Fri, 2004-09-24 at 13:25, Richard Lewis wrote:
I've just found one more problem though: it won't stop!!
# /etc/init.d/tomcat stop doesn't return any errors but I had a look and found that the directory /var/run/tomcat was empty; it seems its left no process id file. Is this why it can't stop?
I don't know how they are implemented; I don't run Debian.
But I'm unclear on your approach. you wrote tomcat.sh which translates init.d-style start/stop arguments to calls into tomcat's start/stop scripts (which internally call catalina.sh with start/stop arguments). Then you're writing another init.d-style script which calls the first. Why write 2 separate scripts?
FWIW, on Gentoo the /etc/init.d/tomcat script just call catalina.sh directly to do the real work:
start-stop-daemon --start --quiet \ --chuid tomcat:tomcat \ --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_START}
-- Martijn
On Friday, Sep 24, 2004, at 14:10 Europe/London, Martijn Koster wrote:
On Fri, 2004-09-24 at 13:25, Richard Lewis wrote:
I've just found one more problem though: it won't stop!!
# /etc/init.d/tomcat stop doesn't return any errors but I had a look and found that the directory /var/run/tomcat was empty; it seems its left no process id file. Is this why it can't stop?
I don't know how they are implemented; I don't run Debian.
But I'm unclear on your approach. you wrote tomcat.sh which translates init.d-style start/stop arguments to calls into tomcat's start/stop scripts (which internally call catalina.sh with start/stop arguments). Then you're writing another init.d-style script which calls the first. Why write 2 separate scripts?
OK, sorry, I just didn't realise it existed. :-( I'm using it now.
But it still doesn't stop properly and I think (from switching off --quiet) that its because start-stop-daemon is looking for a process called catalina.sh (I still can't get it to create a process id file) which it doesn't find because the process is called 'java'.
So I've resorted to a less elegant solution:
stop) $DAEMON stop
Thanks for your help.
Richard
On Fri, 2004-09-24 at 14:40, Richard Lewis wrote:
But it still doesn't stop properly and I think (from switching off --quiet) that its because start-stop-daemon is looking for a process called catalina.sh (I still can't get it to create a process id file) which it doesn't find because the process is called 'java'.
I very much doubt the running process name is relevant; if they did kill processes by name they might end up shooting the wrong one.
The "catalina.sh stop" first tries to shut down tomcat gracefully (by invoking java), and kills it otherwise. So you don't need/want the init.d script to do the killing.
From the Gentoo /etc/init.d/tomcat script:
stop() { ebegin "Stopping Tomcat" start-stop-daemon --start --quiet \ --chuid tomcat:tomcat \ --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_STOP}
Note that it calls "--start", not "--stop".
That's essentially the same as your solution.
-- Martijn