Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-15-2006, 01:52 AM
|
#1
|
LQ Newbie
Registered: May 2006
Location: CT
Distribution: Slackware
Posts: 9
Rep:
|
how to get Tomcat to run on startup?
Thank you to all of you who helped me get Slackware installed and running.
I just installed Apache Tomcat, and it runs fine, but I can't seem to get it to run on startup (boot up) of the machine. What else do I need to do?
Just like I did successfully with MySQL when I installed it, I added the following to /etc/rc.d/rc.M (after the code which launches Apache):
if [ -x /etc/rc.d/rc.tomcat ]' then
. /etc/rc.d/rc.tomcat start
fi
Manually, I created the rc.tomcat (owned by root:root with -rwxr-xr-x permissions) and it contains:
case "$1" in
'start')
/apache-tomcat-5.5.17/bin/startup.sh
;;
'stop')
/apache-tomcat-5.5.17/bin/shutdown.sh
;;
'restart')
/apache-tomcat-5.5.17/bin/shutdown.sh
sleep 3
/apache-tomcat-5.5.17/bin/startup.sh
;;
*)
echo "usage $0 start|stop|restart"
esac
Now, if I login as root and type "/etc/rc.d/rc.tomcat start" from the command line, Tomcat starts just fine. So I guess my script is okay. If I copy/paste the code piece inside rc.M into a temporary file and execute it, Tomcat starts fine. So why doesn't Tomcat startup automatically when I first boot the machine? What else do I need to do?
Is there a log file somewhere that I can look at? Nothing in /apache-tomcat-5.5.17/logs seems to be helpful.
|
|
|
06-15-2006, 01:54 AM
|
#2
|
LQ Newbie
Registered: May 2006
Location: CT
Distribution: Slackware
Posts: 9
Original Poster
Rep:
|
typo
...don't worry, my script really does have the ; instead of the '
if [ -x /etc/rc.d/rc.tomcat ]; then
|
|
|
06-15-2006, 02:54 AM
|
#3
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
|
You should use:
Code:
export JAVA_HOME=/path/to/java
export CATALINA_HOME=/path/to/tomcat
before anthing else in your script, since those env. variables are not defined yet.
Regards
|
|
|
06-15-2006, 09:26 AM
|
#4
|
LQ Newbie
Registered: May 2006
Location: CT
Distribution: Slackware
Posts: 9
Original Poster
Rep:
|
fixed!
That did it!
I had the export statements in /etc/profile, but I guess that must be read after /etc/rc.d/rc.M, because moving the export statements to rc.M just prior to calling /etc/rc.d/rc.tomcat did the trick.
Maybe this is basic stuff to you folks, but I don't know how I would hae figured it out as a newbie without you. Thanks!
|
|
|
08-04-2006, 01:51 AM
|
#5
|
Member
Registered: Jan 2005
Location: London
Distribution: Fedora 6
Posts: 31
Rep:
|
Hi,
I have installed Tomcat (following Marty Hall's excellent guide) and everything works fine.
My question is in relation to the startup.sh and catalina.sh files. Why do I need to be root user to start Tomcat? Is there a way to allow the local user to do this?
The only thing I've spotted is that the file tomcat-users.xml is root:root - all else is localuser:users.
So my problem is that I have to su - root each time I need to control the server.
Regards,
Lee.
|
|
|
08-04-2006, 02:41 AM
|
#6
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep: 
|
I have a tomcat user and tomcat group and I just did chown -R tomcat:tomcat /usr/local/apache-tomcat-5.5.17 - then in my start up script I have:
Code:
/bin/su - tomcat -c /usr/local/bin/start-tomcat.sh
start-tomcat.sh has the environment variables I need and calls the Tomcat startup stuff.
Last edited by gilead; 08-04-2006 at 02:43 AM.
|
|
|
08-04-2006, 03:15 AM
|
#7
|
Member
Registered: Jan 2005
Location: London
Distribution: Fedora 6
Posts: 31
Rep:
|
Thanks for this Steve.
I had created symbolic links to the startup/shutdown scripts and placed them in my home directory.
I also had chgrp/chown the tomcat installation directory in favour of my local user - so I thought that would work.
Does your tomcat user have (root like) higher privileges than a default user?
I must admit that I'm not too familiar with the su options and I guess I can substitute root for your tomcat on my machine (not recommended I know).
Regards,
Lee.
|
|
|
08-04-2006, 03:56 PM
|
#8
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep: 
|
My tomcat user is a regular user, but for other users in the tomcat group I had to run the following so they could write to the Tomcat directories:
Code:
find /usr/local/apache-tomcat-5.5.17 -type d -exec chmod -c g+ws {} \;
That gave write permissions to the tomcat group to all Tomcat directories as well as making sure the group ownership of files stays at tomcat. My install is for dev/testing so I let the users write to config files, libs, etc. as well as the webapps directory. Nobody but the administrator has rights to the acceptance test and production boxes...
|
|
|
09-19-2006, 11:24 PM
|
#9
|
Member
Registered: Apr 2006
Posts: 45
Rep:
|
tomcat startup script
Hi all,
I got which i wrote for my tomcat version 5.0.27 using jsdk 1.4.2 to startup in /etc/init.d but i have some problem with it. Is there any kind soul who can me here. thanks amillion in advance.
Code:
#!/bin/bash
#
# Source function library.
. /etc/rc.d/init.d/functions
export JAVA_HOME=/opt/j2sdk
export CLASSPATH=.:/opt/j2sdk/lib/tools.jar:/opt/j2sdk/lib/rt.jar
export PATH=/opt/j2sdk/bin:/j2sdk/bin:$PATH
RETVAL=$?
JAVA_OPTS="-Xincgc -Xms64m -Xmx512m"
SITE_ROOT="/opt/tomcat"
SITES='ls ${SITE_ROOT}
case "$1" in
start)
for x in ${SITES}
do
CATALINA_BASE="${SITE_ROOT}/${x}/tomcat"
if [ -f $CATALINA_BASE/bin/startup.sh];
then
echo "Starting Server: ${x}"
JAVA_OPTS="${JAVA_OPTS}"
$CATALINA_BASE/bin/startup.sh
fi
done
;;
stop)
for x in ${SITES}
do
CATALINA_BASE="${SITE_ROOT}/${x}/tomcat"
if [ -f $CATALINA_BASE/bin/shutdown.sh];
then
echo "Shutting down Server: ${x}"
$CATALINA_BASE/bin/shutdown.sh
fi
done
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
|
|
|
All times are GMT -5. The time now is 06:07 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|