You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "John B. Moore" <jb...@microps.com> on 2003/03/10 15:04:41 UTC

Starting Tomcat on Linux as a Service??

Folks,

    One can start Apache by placing the command in the rc.local

    /usr/local/apache/bin/apachectl.sh start

    but it appears that you can not do that with tomcat because of the 
need for various environmental variables (JAVA_HOME ..etc..)

    Any one have a suggestion on how to get both tomcat and apache to 
start (tomcat first) when the server reboots..???

     Thanks...

     John...


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mufaddal Khumri <mu...@wmotion.com>.
Did you read my second email ?

The certificate that you generate ... is your certificate generation 
application associating the host name and the certificate ? Lets say 
the host tomcat is running on is my.webserver.com .... then is your 
certificate generating app associating this with the certificate its 
generating ?

Thanks.

On Friday, March 14, 2003, at 03:19  AM, Mark Liu wrote:

> Hello, thank you very much for your reply.
>
> I think server.xml is irrelevant to my problem, since
> I am able to run Tomcat SSL using the certificate that
> is generated by keytool.
>
> --- Mufaddal Khumri <mu...@wmotion.com> wrote:
>> Have you edited your server.xml ?
>>
>>      <!-- Define a SSL Coyote HTTP/1.1 Connector on
>> port 8443 -->
>>
>>      <Connector
>>
> className="org.apache.coyote.tomcat4.CoyoteConnector"
>>                 port="8443" minProcessors="5"
>> maxProcessors="75"
>>                 enableLookups="true"
>> 	       acceptCount="100" debug="0" scheme="https"
>> secure="true"
>>                 useURIValidationHack="false"
>> disableUploadTimeout="true">
>>        <Factory
>>
> className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
>>                 clientAuth="false" protocol="TLS" />
>>      </Connector>
>>
>> On Thursday, March 13, 2003, at 11:09  AM, Mark Liu
>> wrote:
>>
>>> I know how to use keytool to generate a
>> self-signed
>>> certificate and run Tomcat with SSL.
>>>
>>> I want to use a certificate that is generated by
>> my
>>> little Java program which is part of my
>> Certification
>>> Authority.
>>>
>>> So I have my little Java program generate a X509
>>> Certificate called cert4ca.cer.
>>>
>>> Then I deletee the tomcat certificate in my
>> keystore
>>> and successfully imported cert4ca.cer into my
>> keystore
>>> as alias tomcat.  See the attached file
>> cert4ca.cer.
>>> It's a valid one, otherwise, I would not have been
>>> able to import it into my keystore.
>>>
>>> After I launch tomcat, I can visit
>> http://localhost,
>>> but not https://localhost.
>>>
>>> However, I am able to visit both http and https if
>> I
>>> use the certificate generated by keytool.
>>>
>>> So, would you please give me a hint, how can I use
>> the
>>> certificate generated by my little Java program to
>> run
>>> tomcat with SSL?
>>>
>>> Thanks a lot in advance.
>>>
>>>
>>> __________________________________________________
>>> Do you Yahoo!?
>>> Yahoo! Web Hosting - establish your business
>> online
>>> http://
>>>
>>
> webhosting.yahoo.com<cert4ca.cer>--------------------------------------
>>
>>> -------------------------------
>>> To unsubscribe, e-mail:
>> tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>> tomcat-user-help@jakarta.apache.org
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> tomcat-user-help@jakarta.apache.org
>>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
Hello, thank you very much for your reply.

I think server.xml is irrelevant to my problem, since
I am able to run Tomcat SSL using the certificate that
is generated by keytool.

--- Mufaddal Khumri <mu...@wmotion.com> wrote:
> Have you edited your server.xml ?
> 
>      <!-- Define a SSL Coyote HTTP/1.1 Connector on
> port 8443 -->
> 
>      <Connector
>
className="org.apache.coyote.tomcat4.CoyoteConnector"
>                 port="8443" minProcessors="5"
> maxProcessors="75"
>                 enableLookups="true"
> 	       acceptCount="100" debug="0" scheme="https"
> secure="true"
>                 useURIValidationHack="false"
> disableUploadTimeout="true">
>        <Factory  
>
className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
>                 clientAuth="false" protocol="TLS" />
>      </Connector>
> 
> On Thursday, March 13, 2003, at 11:09  AM, Mark Liu
> wrote:
> 
> > I know how to use keytool to generate a
> self-signed
> > certificate and run Tomcat with SSL.
> >
> > I want to use a certificate that is generated by
> my
> > little Java program which is part of my
> Certification
> > Authority.
> >
> > So I have my little Java program generate a X509
> > Certificate called cert4ca.cer.
> >
> > Then I deletee the tomcat certificate in my
> keystore
> > and successfully imported cert4ca.cer into my
> keystore
> > as alias tomcat.  See the attached file
> cert4ca.cer.
> > It's a valid one, otherwise, I would not have been
> > able to import it into my keystore.
> >
> > After I launch tomcat, I can visit
> http://localhost,
> > but not https://localhost.
> >
> > However, I am able to visit both http and https if
> I
> > use the certificate generated by keytool.
> >
> > So, would you please give me a hint, how can I use
> the
> > certificate generated by my little Java program to
> run
> > tomcat with SSL?
> >
> > Thanks a lot in advance.
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - establish your business
> online
> > http:// 
> >
>
webhosting.yahoo.com<cert4ca.cer>--------------------------------------
> 
> > -------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mufaddal Khumri <mu...@wmotion.com>.
Have you edited your server.xml ?

     <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->

     <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                port="8443" minProcessors="5" maxProcessors="75"
                enableLookups="true"
	       acceptCount="100" debug="0" scheme="https" secure="true"
                useURIValidationHack="false" disableUploadTimeout="true">
       <Factory  
className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
                clientAuth="false" protocol="TLS" />
     </Connector>

On Thursday, March 13, 2003, at 11:09  AM, Mark Liu wrote:

> I know how to use keytool to generate a self-signed
> certificate and run Tomcat with SSL.
>
> I want to use a certificate that is generated by my
> little Java program which is part of my Certification
> Authority.
>
> So I have my little Java program generate a X509
> Certificate called cert4ca.cer.
>
> Then I deletee the tomcat certificate in my keystore
> and successfully imported cert4ca.cer into my keystore
> as alias tomcat.  See the attached file cert4ca.cer.
> It's a valid one, otherwise, I would not have been
> able to import it into my keystore.
>
> After I launch tomcat, I can visit http://localhost,
> but not https://localhost.
>
> However, I am able to visit both http and https if I
> use the certificate generated by keytool.
>
> So, would you please give me a hint, how can I use the
> certificate generated by my little Java program to run
> tomcat with SSL?
>
> Thanks a lot in advance.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http:// 
> webhosting.yahoo.com<cert4ca.cer>-------------------------------------- 
> -------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
I just gave it a test.

I have a working keystore on host A, and I copied that
keystore to host B.  And it works for both.  In other
words, I am able to launch Tomcat SSL with the same
keytool-generated certificate on 2 different hosts.

Any idea about how to run Tomcat SSL with my own
CA-generated certificate?


--- Mufaddal Khumri <mu...@wmotion.com> wrote:
> The certificate that you generate ... is your
> certificate generation  
> application associating the host name and the
> certificate ? Lets say  
> the host tomcat is running on is my.webserver.com
> .... then is your  
> certificate generating app associating this with the
> certificate its  
> generating ?
> 
> Thanks.
> 
> On Thursday, March 13, 2003, at 11:09  AM, Mark Liu
> wrote:
> 
> > I know how to use keytool to generate a
> self-signed
> > certificate and run Tomcat with SSL.
> >
> > I want to use a certificate that is generated by
> my
> > little Java program which is part of my
> Certification
> > Authority.
> >
> > So I have my little Java program generate a X509
> > Certificate called cert4ca.cer.
> >
> > Then I deletee the tomcat certificate in my
> keystore
> > and successfully imported cert4ca.cer into my
> keystore
> > as alias tomcat.  See the attached file
> cert4ca.cer.
> > It's a valid one, otherwise, I would not have been
> > able to import it into my keystore.
> >
> > After I launch tomcat, I can visit
> http://localhost,
> > but not https://localhost.
> >
> > However, I am able to visit both http and https if
> I
> > use the certificate generated by keytool.
> >
> > So, would you please give me a hint, how can I use
> the
> > certificate generated by my little Java program to
> run
> > tomcat with SSL?
> >
> > Thanks a lot in advance.
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - establish your business
> online
> > http:// 
> >
>
webhosting.yahoo.com<cert4ca.cer>--------------------------------------
> 
> > -------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
OK, are you suggesting that the certificate generated
by keytool associates the host name and the
certificate?  

--- Mufaddal Khumri <mu...@wmotion.com> wrote:
> The certificate that you generate ... is your
> certificate generation  
> application associating the host name and the
> certificate ? Lets say  
> the host tomcat is running on is my.webserver.com
> .... then is your  
> certificate generating app associating this with the
> certificate its  
> generating ?
> 
> Thanks.
> 
> On Thursday, March 13, 2003, at 11:09  AM, Mark Liu
> wrote:
> 
> > I know how to use keytool to generate a
> self-signed
> > certificate and run Tomcat with SSL.
> >
> > I want to use a certificate that is generated by
> my
> > little Java program which is part of my
> Certification
> > Authority.
> >
> > So I have my little Java program generate a X509
> > Certificate called cert4ca.cer.
> >
> > Then I deletee the tomcat certificate in my
> keystore
> > and successfully imported cert4ca.cer into my
> keystore
> > as alias tomcat.  See the attached file
> cert4ca.cer.
> > It's a valid one, otherwise, I would not have been
> > able to import it into my keystore.
> >
> > After I launch tomcat, I can visit
> http://localhost,
> > but not https://localhost.
> >
> > However, I am able to visit both http and https if
> I
> > use the certificate generated by keytool.
> >
> > So, would you please give me a hint, how can I use
> the
> > certificate generated by my little Java program to
> run
> > tomcat with SSL?
> >
> > Thanks a lot in advance.
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - establish your business
> online
> > http:// 
> >
>
webhosting.yahoo.com<cert4ca.cer>--------------------------------------
> 
> > -------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mufaddal Khumri <mu...@wmotion.com>.
The certificate that you generate ... is your certificate generation  
application associating the host name and the certificate ? Lets say  
the host tomcat is running on is my.webserver.com .... then is your  
certificate generating app associating this with the certificate its  
generating ?

Thanks.

On Thursday, March 13, 2003, at 11:09  AM, Mark Liu wrote:

> I know how to use keytool to generate a self-signed
> certificate and run Tomcat with SSL.
>
> I want to use a certificate that is generated by my
> little Java program which is part of my Certification
> Authority.
>
> So I have my little Java program generate a X509
> Certificate called cert4ca.cer.
>
> Then I deletee the tomcat certificate in my keystore
> and successfully imported cert4ca.cer into my keystore
> as alias tomcat.  See the attached file cert4ca.cer.
> It's a valid one, otherwise, I would not have been
> able to import it into my keystore.
>
> After I launch tomcat, I can visit http://localhost,
> but not https://localhost.
>
> However, I am able to visit both http and https if I
> use the certificate generated by keytool.
>
> So, would you please give me a hint, how can I use the
> certificate generated by my little Java program to run
> tomcat with SSL?
>
> Thanks a lot in advance.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http:// 
> webhosting.yahoo.com<cert4ca.cer>-------------------------------------- 
> -------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
I know how to use keytool to generate a self-signed
certificate and run Tomcat with SSL.

I want to use a certificate that is generated by my
little Java program which is part of my Certification
Authority.

So I have my little Java program generate a X509
Certificate called cert4ca.cer.

Then I deletee the tomcat certificate in my keystore
and successfully imported cert4ca.cer into my keystore
as alias tomcat.  See the attached file cert4ca.cer. 
It's a valid one, otherwise, I would not have been
able to import it into my keystore.

After I launch tomcat, I can visit http://localhost,
but not https://localhost.

However, I am able to visit both http and https if I
use the certificate generated by keytool.

So, would you please give me a hint, how can I use the
certificate generated by my little Java program to run
tomcat with SSL?

Thanks a lot in advance.


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

Why can't I use my CA-generated certificate for tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
I know how to use keytool to generate a self-signed
certificate and run Tomcat with SSL.

I want to use a certificate that is generated by my
little Java program which is part of my Certification
Authority.

So I have my little Java program generate a X509
Certificate called cert4ca.cer.

Then I deletee the tomcat certificate in my keystore
and successfully imported cert4ca.cer into my keystore
as alias tomcat.  See the attached file cert4ca.cer. 
It's a valid one, otherwise, I would not have been
able to import it into my keystore.

After I launch tomcat, I can visit http://localhost,
but not https://localhost.

However, I am able to visit both http and https if I
use the certificate generated by keytool.

So, would you please give me a hint, how can I use the
certificate generated by my little Java program to run
tomcat with SSL?

Thanks a lot in advance.

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

Why can't I use my CA-generated certificate for Tomcat SSL?

Posted by Mark Liu <ma...@yahoo.com>.
I know how to use keytool to generate a self-signed
certificate and run Tomcat with SSL.

I want to use a certificate that is generated by my
little Java program which is part of my Certification
Authority.

So I have my little Java program generate a X509
Certificate called cert4ca.cer.

Then I deletee the tomcat certificate in my keystore
and successfully imported cert4ca.cer into my keystore
as alias tomcat.  See the attached file cert4ca.cer. 
It's a valid one, otherwise, I would not have been
able to import it into my keystore.

After I launch tomcat, I can visit http://localhost,
but not https://localhost.

However, I am able to visit both http and https if I
use the certificate generated by keytool.

So, would you please give me a hint, how can I use the
certificate generated by my little Java program to run
tomcat with SSL?

Thanks a lot in advance.



__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

Re: Starting Tomcat on Linux as a Service??

Posted by "John B. Moore" <jb...@microps.com>.
Jon,

    Ok, making progress.. here is some info that might help others "at 
my level"...<G> .. but I still have a loose end...<sigh>

What I did:

     Tomcat was not starting so I attempted to run the same start 
command from the commandline..

    .. and got a pile of "permission denied"

   .. I then added the "tomcat" user to the admin.. no help.. then to 
the root group.. better but still joy.. I then realized that it was only 
the "$CATALINA_HOME/logs" directory that was having problems so I then 
changed the permissions on that directory.. (I had installed tomcat as 
root... my bad, I guess..) adding "write" permissions to "others"

     That got me "started" or so it seemed..

      No error, but no joy..  What is strange is that if I try on the 
commandline

    /bin/su tomcat $CATALINA_HOME/bin/startup.sh

   .. it still will not start Tomcat either..  only

     $CATALINA_HOME/bin/startup.sh

     ...will start tomcat..  It appears that trying to run Tomcat under 
the user "tomcat" will not work..???

    ...I then removed the "/bin/su tomcat" from the script and...no joy 
either..

    Obviously there is more to this that I understand...

    Any thoughts on this mystery...??

    John...

     

Jon Roberts wrote:

> John B. Moore wrote:
>
>>    Any one have a suggestion on how to get both tomcat and apache to 
>> start (tomcat first) when the server reboots..???
>
>
> Instead of rc.local, it would be more customary to use an 
> initialization script in /etc/init.d. Look in this path to find 
> examples for other services. As far as how the scripts should read, 
> here are some examples posted by another list member which are pretty 
> instructive:
>
> http://tinyurl.com/5s4x
>
> Good luck.
>
> Jon Roberts
> www.mentata.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Starting Tomcat on Linux as a Service??

Posted by "John B. Moore" <jb...@microps.com>.
Perfect, Just what I was hoping I would find....

   John...

Jon Roberts wrote:

> John B. Moore wrote:
>
>>    Any one have a suggestion on how to get both tomcat and apache to 
>> start (tomcat first) when the server reboots..???
>
>
> Instead of rc.local, it would be more customary to use an 
> initialization script in /etc/init.d. Look in this path to find 
> examples for other services. As far as how the scripts should read, 
> here are some examples posted by another list member which are pretty 
> instructive:
>
> http://tinyurl.com/5s4x
>
> Good luck.
>
> Jon Roberts
> www.mentata.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Starting Tomcat on Linux as a Service??

Posted by Jon Roberts <jo...@mentata.com>.
John B. Moore wrote:
>    Any one have a suggestion on how to get both tomcat and apache to 
> start (tomcat first) when the server reboots..???

Instead of rc.local, it would be more customary to use an initialization 
script in /etc/init.d. Look in this path to find examples for other 
services. As far as how the scripts should read, here are some examples 
posted by another list member which are pretty instructive:

http://tinyurl.com/5s4x

Good luck.

Jon Roberts
www.mentata.com



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Starting Tomcat on Linux as a Service??

Posted by Jeremy Whitlock <jw...@starprecision.com>.
John,
	Here is a script that will let you use Tomcat as a service.
Here it is:

#!/bin/bash
#
# Startup script for Jakarta Tomcat
#
# chkconfig: 345 84 16
# description: Jakarta Tomcat Java Servlet/JSP Container



TOMCAT_HOME=/usr/local/tomcat/tomcat-4.1.18
TOMCAT_START=/usr/local/tomcat/tomcat-4.1.18/bin/startup.sh
TOMCAT_STOP=/usr/local/tomcat/tomcat-4.1.18/bin/shutdown.sh

#Necessary environment variables
export CATALINA_HOME=/usr/local/tomcat/tomcat-4.1.18
export JAVA_HOME=/usr/java/jdk1.3.1_07
export LD_KERNEL_ASSUME="2.2.5"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
    echo "Tomcat not available..."
    exit
fi

start() {
    echo -n "Starting Tomcat: "
    daemon $TOMCAT_START
    echo
    touch /var/lock/subsys/tomcatd
# We may need to sleep here so it will be up for apache
#    sleep 5
#Instead should check to see if apache is up by looking for http.pid
}

stop() {
    echo -n $"Shutting down Tomcat: "
    daemon $TOMCAT_STOP
    rm -f /var/lock/subsys/tomcatd.pid
    echo
}

status() {
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap
start" | awk '{printf $1 " "}' | wc | awk '{print $2}' >
/tmp/tomcat_process_count.txt
   read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
    echo -n "tomcatd ( pid "
    ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap
start" | awk '{printf $1 " "}'
    echo -n ") is running..."
else
    echo -n "Tomcat is stopped"
fi
}

case "$1" in
    start)
	start
	;;
     stop)
	stop
	;;
     restart)
	stop
	sleep 3
	start
	;;
     status)
	status
	;;
     *)
	echo "Usage: tomcatd {start|stop|restart|status}"
     exit 1
esac



If you save this as "tomcatd" in the /etc/init.d/ directory, you can
then do:

chkconfig --add tomcatd

Now, you can use the "Service" tool from the GUI to start/stop your
service PLUS assign it to start up at boot.  Also, the way it starts now
is:

/sbin/service tomcat start

You will notice the "Usage" portion of the script.  This will tell you
what parameters you can add:

/sbin/service tomcatd <parameter>

Hope this helps, Jeremy

P.S. - I got one for Apache also if you need it.  Remember to change the
path to your Tomcat installaion and the catalina.sh.

-----Original Message-----
From: John B. Moore [mailto:jbm@microps.com] 
Sent: Monday, March 10, 2003 7:05 AM
To: tomcat-user@jakarta.apache.org
Subject: Starting Tomcat on Linux as a Service??

Folks,

    One can start Apache by placing the command in the rc.local

    /usr/local/apache/bin/apachectl.sh start

    but it appears that you can not do that with tomcat because of the 
need for various environmental variables (JAVA_HOME ..etc..)

    Any one have a suggestion on how to get both tomcat and apache to 
start (tomcat first) when the server reboots..???

     Thanks...

     John...


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org