Hi Mark, jsvc, of course! Unfortunately it was not in my mind at my first attempt. I have altered my init script and added jsvc. Now tomcat starts at boot time properly.
Thanks for your suggestion. Mark Shifman schrieb: > You need to add lines like this to the init script. > http://www.linuxjournal.com/article/4445 > # chkconfig: 345 80 20 > # description: Tomcat 6.0 > so it knows to start on reboot. > > You also may want to use jsvc to start and stop tomcat instead of > [startup|shutdown].sh > http://tomcat.apache.org/tomcat-6.0-doc/setup.html > this allows you to run tomcat as another user. > Example scripts are included in TOMCAT_HOME/bin/jsvc.tar.gz > mas > Peter Lokus wrote: >> Hi list, >> >> I'm running an fresh tomcat 6.0.20 from tomcat.apache.org under /opt/tomcat. >> Currently, I'm firing up tomcat with the supplied [startup|shutdown].sh >> scripts manually. >> >> Now, tomcat shall start automatically. For this purpose I created a >> small script under /etc/init.d/tomcat5: >> >> #!/bin/bash >> # >> # tomcat5 This shell script takes care of starting and stopping #Tomcat >> # >> >> function start() { >> echo -n "Starting ${TOMCAT_PROG}: " >> /opt/tomcat/bin/startup.sh >> return "$?" >> } >> >> function stop() { >> echo -n "Stopping $TOMCAT_PROG: " >> /opt/tomcat/bin/shutdown.sh >> } >> >> # See how we were called. >> case "$1" in >> start) >> start >> ;; >> stop) >> stop >> ;; >> restart) >> stop >> sleep 2 >> start >> ;; >> *) >> echo "Usage: $TOMCAT_PROG {start|stop|restart}" >> exit 1 >> esac >> >> Symlink'd it to >> [r...@int01 init.d]# ln -s /etc/init.d/tomcat5 /etc/rc3.d/S99tomcat5 >> [r...@int01 init.d]# ln -s /etc/init.d/tomcat5 /etc/rc3.d/K99tomcat5 >> [r...@int01 init.d]# ln -s /etc/init.d/tomcat5 /etc/rc6.d/K99tomcat5 >> >> My script runs with "service tomcat5 [start|stop]" perfectly. >> However, after a reboot tomcat is not reachable through HTTP. >> >> >> Here is the machine state after a reboot: >> >> [r...@int01 ~]# lsof -i:8080 >> COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME >> java 2139 root 34u IPv6 6215 TCP *:webcache (LISTEN) >> >> (I should considering not to run tomcat under root) >> >> [r...@int01 ~]# ps waux | grep 2139 >> root 2139 1.0 4.5 222744 46860 ? Sl 10:11 0:05 >> /usr/bin/java >> -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties >> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager >> -Dappserver.home=/opt/tomcat -Dappserver.base=/opt/tomcat >> -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath >> :/opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat >> -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp >> org.apache.catalina.startup.Bootstrap start >> >> [r...@int01 ~]# service tomcat5 stop >> Stopping : Using CATALINA_BASE: /opt/tomcat >> Using CATALINA_HOME: /opt/tomcat >> Using CATALINA_TMPDIR: /opt/tomcat/temp >> Using JRE_HOME: /usr >> Jul 22, 2009 10:20:14 AM org.apache.catalina.startup.Catalina stopServer >> SEVERE: Catalina.stop: >> java.net.ConnectException: Connection refused >> at java.net.PlainSocketImpl.socketConnect(Native Method) >> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) >> at >> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) >> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) >> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) >> at java.net.Socket.connect(Socket.java:519) >> at java.net.Socket.connect(Socket.java:469) >> at java.net.Socket.<init>(Socket.java:366) >> at java.net.Socket.<init>(Socket.java:180) >> at >> org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:597) >> at >> org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337) >> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415) >> >> [r...@int01 ~]# java -version >> java version "1.6.0_06" >> Java(TM) SE Runtime Environment (build 1.6.0_06-b02) >> Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing) >> >> >> After a "kill -9 <pid>" and a "service tomcat5 start" tomcat is running >> as usual. >> >> >> Something went wrong. Do I need some additional environment variables >> for tomcat in my script? Or is it something else? >> >> Thanks in advance. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org