How To set up RH9 and clones to start automatically and use port 80 with a non root user.
If you have not created the user that you plan to specify in the script then do this first. Follow the directions under Tomcat setup located at: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/setup.html This will create the executable needed by the script to start Tomcat. If you followed the directions you will find the file jsvc in $CATALINA_HOME/bin In the$CATALINA_HOME/bin/jsvc-src/native directory there is a file named Tomcat.sh or if you have the non Alpha package both a Tomcat.sh and Tomcat5.sh For this How To we are using TC5. I renamed my file to tomcat to match the other files in init.d #cp $CATALINA_HOME/bin/jsvc-src/native/Tomcat5.sh /etc/init.d/tomcat #cd /etc/init.d #vi tomcat OR your editor of choice Now edit the file to contain the proper environment setting for your machine. When you are done it will look something like this: # Adapt the following lines to your configuration JAVA_HOME=/tomcat/java CATALINA_HOME=/tomcat/tc5 DAEMON_HOME=/tomcat/tc5/bin TOMCAT_USER=tomcat TMP_DIR=/var/tmp CATALINA_OPTS= CLASSPATH=\ $JAVA_HOME/lib/tools.jar:\ $CATALINA_HOME/bin/commons-daemon.jar:\ $CATALINA_HOME/bin/bootstrap.jar case "$1" in start) # # Start Tomcat # $DAEMON_HOME/jsvc \ -user $TOMCAT_USER \ -home $JAVA_HOME \ -Dcatalina.home=$CATALINA_HOME \ -Djava.io.tmpdir=$TMP_DIR \ -outfile $CATALINA_HOME/logs/catalina.out \ -errfile '&1' \ $CATALINA_OPTS \ -cp $CLASSPATH \ -Xms256m \ -Xmx384m \ org.apache.catalina.startup.Bootstrap # # To get a verbose JVM #-verbose \ # To get a debug of jsvc. #-debug \ ;; stop) # # Stop Tomcat # PID=`cat /var/run/jsvc.pid` kill $PID ;; *) echo "Usage tomcat start/stop" exit 1;; esac This is for an install of Tomcat 5 to the directory of /tomcat/tc5 The java home dir is /tomcat/java If you followed the install directions your jsvc executable(DAEMON_HOME) will be in /tomcat/tc5/bin ($CATALINA_HOME/bin) if not then do a search for jsvc. If you do not have the Tomcat5 version then change the line: org.apache.catalina.startup.BootstrapService to this: org.apache.catalina.startup.Bootstrap I have added two setting for my memory: -Xms256m \ -Xmx384m \ There are other way to set this in the file but mine works for me so I left it alone. Set the values to meet your needs or delete if you plan to run the default. Now while you are still in the init.d directory #./tomcat start tomcat should start up and if you do a ps -ax you will see jsvc listed. If you do then it's all down hill from here. #cd /etc/rc3.d #ln -s ../init.d/tomcat /etc/rc3.d/S15tomcat #ln -s ../init.d/tomcat /etc/rc4.d/S15tomcat #ln -s ../init.d/tomcat /etc/rc5.d/S15tomcat Now to make life a little easier #ln -s /etc/init.d/tomcat /usr/sbin/tomcat Now from any prompt enter #tomcat stop or #tomcat start to stop/start tomcat. Just a note: The httpd starts at S15 also. If you are running both Tomcat and Apache set this to either 16 to start it after Apache or 14 to start it before Apache. I only run Tomcat so I used 15. And just to let those who don't know only files that are named SXXsomething, where XX is a two digit number that indicates the starting order of the files, are started. The file with a KXXxxxxxx are not started. And yes that is an upper case S or it will be ignored. Good luck and watch for typos. Doug www.parsonstechnical.com ----- Original Message ----- From: "Ing. Enrique de la Barrera Perez" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, May 04, 2004 7:44 PM Subject: Re: �how to use tomcat.sh for starting Tomcat automatically at boot time? > no, i start/stop tomcat manually by > $CATALINA_HOME/bin/startup.sh > $CATALINA_HOME/bin/shutdown.sh > �? > > ----- Original Message ----- > From: "Parsons Technical Services" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Tuesday, May 04, 2004 12:38 PM > Subject: Re: �how to use tomcat.sh for starting Tomcat automatically at boot > time? > > > What command are you using to start and stop it manually? > > From your post it appears that you are running jsvc. Is this correct? > > Let me know and I will walk you through what to do. > > If you get it going in the mean time post to the list. > > From a prior post you said you are running on port 80. > > I had the same issues that you have. Sorry that I did not follow through > earlier as I thought you had figured it out. > The steps are lengthy but simple, so be patient as it will take a little > time to write them up. > > > Doug > > > ----- Original Message ----- > From: "Ing. Enrique de la Barrera Perez" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Tuesday, May 04, 2004 4:09 PM > Subject: �how to use tomcat.sh for starting Tomcat automatically at boot > time? > > > Hello Tomcat users. > I have tried different ways to configure my linux to startup tomcat at boot > time automatically > without results. > In the Tomcat setup documentation thats ships with the installation i can > see this: > ("The file $CATALINA_HOME/bin/jsvc/native/tomcat.sh can be used as a > template for starting Tomcat automatically at boot time from /etc/init.d") > > I am using redhat 9, tomcat 5, jdk 1.4.2. and my tomcat runns very well, > just that i need to start/stop mannually > �anybody there have been in a similar situation than mine? > �could somebody help me on what should a do to achieve this? > > Regards > ebarrera > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
