Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Nov 05, 2007 6:29 pm 
Offline
Newbie

Joined: Mon Nov 05, 2007 6:18 pm
Posts: 2
Hello I am sort of new to VPS hosting and have a little Linux experience. I just got a Linode 450 and set it up running Suse 10.3 with MySQL5, Tomcat 5.5, webmin, and the Susefirewall. (I opened port 8080 on the firewall so that is not the problem)

The problem I am having is I cannot seem to get Tomcat to start automatically when the linode is booted. I can login via SSH and enter "/etc/init.d/tomcat55 start" and it will start.

I have set the runlevel to be 3, 5 and set it to run on boot via webmin also but to no avail. I even tried creating a cronjob that would run the tomcat55 start command on boot but it says "failed" even when I test it.

Any help would be greatly appreciated :)


Top
   
 Post subject:
PostPosted: Mon Nov 05, 2007 8:53 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
Well, grep-ing the systom boot log for 'tomcat' might show an error message.

James


Top
   
 Post subject:
PostPosted: Mon Nov 05, 2007 11:32 pm 
Offline
Newbie

Joined: Mon Nov 05, 2007 6:18 pm
Posts: 2
It turns out that the init script for tomcat on Suse 10.3 is flawed and will not work unless a user is actually logged in.

I finally just gave up and installed Tomcat 6.0.14 which incidentally is not available in an RPM but the installation is literally just untaring and putting it in some directory. Then it was just a matter of making a simple startup script:
Code:
#!/bin/bash
#
# tomcat  boot script

RETVAL=$?
CATALINA_HOME="/tomcat6"


export JAVA_HOME="/usr/lib/jvm/java"


    case $1 in
    start)
            sh /tomcat6/bin/startup.sh
            ;;
    stop) 
            sh /tomcat6/bin/shutdown.sh
            ;;
    restart)
            sh /tomcat6/bin/shutdown.sh
            sh /tomcat6/bin/startup.sh
            ;;
    esac   
    exit 0


Placing it in /etc/init.d, Chmod +X starttomcat.sh
For some reason it would still return errors when set to boot so I just added a cronjob that executed "/etc/init.d/starttomcat.sh start" on boot.

This may not be the most elegant solution but until the tomcat RPM is fixed this is the only thing that worked for me. (The premade boot script also fails to work on my full desktop Suse 10.3 install so this is not an isolated occurance)

This is probably a better solution anyway since I decided not to use Apache and route to tomcat. Tomcat 5 was the first version to have a built in component for serving static content, Tomcat 6 has since improved making apache not needed (unless one wants/needs PHP)


Top
   
 Post subject:
PostPosted: Wed Nov 14, 2007 4:15 pm 
Offline
Senior Member

Joined: Mon Jul 30, 2007 9:55 pm
Posts: 80
Dunno anything about SUSE, but I start Tomcat 5 from init using jsvc (http://commons.apache.org/daemon/jsvc.html). Jsvc is nice /c it lets you start Tomcat as any user, even one with no login shell (which is more secure).

I run Gentoo, but here's my init script which you should be able to easily adapt to SUSE:

Code:
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
        need net
        use apache dns logger netmount
        after sshd
}

configtest() {
        ebegin "Checking Apache Tomcat Configuration"
        checkconfig
        eend $?
}

checkconfig() {
        [ -z ${JAVA_HOME} ] && return 1
        [ -z ${CATALINA_HOME} ] && return 1
        [ -z ${CATALINA_BASE} ] && return 1
        return 0
}

start() {
        checkconfig || return 1
        ebegin "Starting tomcat"
        cd  ${CATALINA_HOME}
        bin/jsvc -home ${JAVA_HOME} \
            -Dcatalina.home=${CATALINA_HOME} \
            -Dcatalina.base=${CATALINA_BASE} \
            -Djava.endorsed.dirs=./common/endorsed \
            -Djava.io.tmpdir=${CATALINA_BASE}/temp \
            -cp ./bin/bootstrap.jar \
            -user apache \
            -wait 60 \
            -outfile ${CATALINA_BASE}/logs/catalina.out \
            -errfile ${CATALINA_BASE}/logs/catalina.err \
            -pidfile /var/run/tomcat.pid \
            org.apache.catalina.startup.Bootstrap
        eend $?
}

stop() {
        checkconfig || return 1
        ebegin "Stopping tomcat"
        cd  ${CATALINA_HOME}
        bin/jsvc -stop -home ${JAVA_HOME} \
            -Dcatalina.home=${CATALINA_HOME} \
            -Dcatalina.base=${CATALINA_BASE} \
            -Djava.endorsed.dirs=./common/endorsed \
            -Djava.io.tmpdir=${CATALINA_BASE}/temp \
            -cp ./bin/bootstrap.jar \
            -user apache \
            -wait 60 \
            -outfile ${CATALINA_BASE}/logs/catalina.out \
            -errfile ${CATALINA_BASE}/logs/catalina.err \
            -pidfile /var/run/tomcat.pid \
            org.apache.catalina.startup.Bootstrap
        eend $?
}


Top
   
 Post subject:
PostPosted: Fri Apr 18, 2008 12:12 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
From adamzieba@gmail.com

Fri Apr 18 07:15:49 EDT 2008

Hi ZunZun,

Regarding http://www.linode.com/forums/viewtopic.php?p=13166 , the solution to the guy's problem is that, like ubuntu and I think Gentoo, SuSE uses something to manage its boot scripts.

*YaST2>System>System Services (Runlevel)>

*click on expert radio button,

*click on the service (You need to have copied it to the /etc/init.d folder 1st)

*click on the runlevel that you want (Probably 5).

I dont really want to register on the forum, so could you post the solution. SuSE is not my 1st choice but cron jobs are def my last.

Thanks,
Adam


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group