You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sixten Otto <si...@sfko.com> on 2010/06/07 23:09:57 UTC

Tomcat startup script

So, looking at the wiki article on setting up Solr with Tomcat
(http://wiki.apache.org/solr/SolrTomcat), there's a link to an
attached init.d script for CentOS/RedHat/Fedora. Trouble is, the wiki
won't let me access it. Even after creating an account and logging in,
clicking on the link
(http://wiki.apache.org/solr/SolrTomcat?action=AttachFile&do=view&target=tomcat6)
gives me the error: "You are not allowed to do AttachFile on this
page."

Is that script posted elsewhere online anywhere?
Am I doing something obviously wrong in trying to access it?

Sixten

Re: Tomcat startup script

Posted by Sixten Otto <si...@sfko.com>.
On Tue, Jun 8, 2010 at 4:18 PM,  <cb...@job.com> wrote:
> The following should work on centos/redhat, don't forget to edit the paths,
> user, and java options for your environment. You can use chkconfig to add it
> to your startup.

Thanks, Colin.

Sixten

RE: Tomcat startup script

Posted by cb...@job.com.
The following should work on centos/redhat, don't forget to edit the paths,
user, and java options for your environment. You can use chkconfig to add it
to your startup.

Note, this script assumes that the Solr webapp is configured using JNDI in a
tomcat context fragment. If not you will need to add something like
-Dsolr.solr.home=/solr/home to the JAVA_OPTS line.

Colin.

#!/bin/sh
# chkconfig: 345 99 1
# description: Tomcat6 service
# processname: java

. /etc/init.d/functions

my_log_message()
    {
        ACTION=$1
        shift

        case "$ACTION" in
            success)
                echo -n $*
                success "$*"
                echo
                ;;
            failure)
                echo -n $*
                failure "$*"
                echo
                ;;
            warning)
                echo -n $*
                warning "$*"
                echo
                ;;
            *)
                ;;
        esac
    }
    log_success_msg()
    {
        my_log_message success "$*"
    }
    log_failure_msg()
    {
        my_log_message failure "$*"
    }
    log_warning_msg()
    {
        my_log_message warning "$*"
    }

export JAVA_HOME=/usr/java/default
export TOMCAT_USER=solr
export CATALINA_HOME=/opt/solr/production/tomcat6
export CATALINA_PID=$CATALINA_HOME/bin/tomcat6.pid
JAVA_OPTS="-server -Xms6G -Xmx6G -XX:+UseConcMarkSweepGC"
export JAVA_OPTS

[ -d "$CATALINA_HOME" ] || { echo "Tomcat requires $CATALINA_HOME."; exit 1;
}

case $1 in

    start|stop|run) 
    if su $TOMCAT_USER bash -c "$CATALINA_HOME/bin/catalina.sh $1"; then
        log_success_msg "Tomcat $1 successful"
        [ $1 == "stop" ] && rm -f $CATALINA_PID
    else
        log_failure_msg "Error in Tomcat $1: $?"
    fi
    ;;

    restart)
    $0 start
    $0 stop
    ;;

    status)
    if [ -f "$CATALINA_PID" ]; then
        read kpid < "$CATALINA_PID"
        if ps --pid $kpid 2>&1 1>/dev/null; then
            echo "$0 is already running at ${kpid}"
        else
            echo "$CATALINA_PID found, but $kpid is not running"
        fi
        unset kpid
    else
        echo "$0 is stopped"
    fi
    ;;

esac   
exit 0


> -----Original Message-----
> From: Sixten Otto [mailto:sixten@sfko.com]
> Sent: Tuesday, June 08, 2010 3:49 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Tomcat startup script
> 
> On Tue, Jun 8, 2010 at 11:00 AM, K Wong <wo...@gmail.com> wrote:
> > Okay. I've been running multicore Solr 1.4 on Tomcat 5.5/OpenJDK 6
> > straight out of the centos repo and I've not had any issues. We're
> not
> > doing anything wild and crazy with it though.
> 
> It's nice to know that the wiki's advice might be out of date. That
> doesn't really help me with my immediate problem (lacking the script
> the wiki is trying to provide), though, unless I want to rip out what
> I've got and start over. :-/
> 
> Sixten




Re: Tomcat startup script

Posted by Sixten Otto <si...@sfko.com>.
On Tue, Jun 8, 2010 at 11:00 AM, K Wong <wo...@gmail.com> wrote:
> Okay. I've been running multicore Solr 1.4 on Tomcat 5.5/OpenJDK 6
> straight out of the centos repo and I've not had any issues. We're not
> doing anything wild and crazy with it though.

It's nice to know that the wiki's advice might be out of date. That
doesn't really help me with my immediate problem (lacking the script
the wiki is trying to provide), though, unless I want to rip out what
I've got and start over. :-/

Sixten

Re: Tomcat startup script

Posted by Chris Harris <ry...@gmail.com>.
For the record, I've been running one of our production Solr 1.4
installs under the Ubuntu 9.04 tomcat6 + OpenJDK. package, and haven't
run into difficulties yet.

On Tue, Jun 8, 2010 at 8:00 AM, K Wong <wo...@gmail.com> wrote:
> Okay. I've been running multicore Solr 1.4 on Tomcat 5.5/OpenJDK 6
> straight out of the centos repo and I've not had any issues. We're not
> doing anything wild and crazy with it though.
>
> K
>
>
>
> On Tue, Jun 8, 2010 at 7:20 AM, Sixten Otto <si...@sfko.com> wrote:
>> On Mon, Jun 7, 2010 at 9:23 PM, K Wong <wo...@gmail.com> wrote:
>>> Did you install tomcat 5.5 from an RPM?
>>
>> I did not, on the advice of that same Solr wiki article that manual
>> installation is "recommended because distribution Tomcats are either
>> old or quirky." There haven't been any issues with this, except that
>> the broken wiki is preventing me from getting to that script.
>>
>> (FWIW, I also installed Tomcat 6.)
>>
>> Sixten
>>
>

Re: Tomcat startup script

Posted by K Wong <wo...@gmail.com>.
Okay. I've been running multicore Solr 1.4 on Tomcat 5.5/OpenJDK 6
straight out of the centos repo and I've not had any issues. We're not
doing anything wild and crazy with it though.

K



On Tue, Jun 8, 2010 at 7:20 AM, Sixten Otto <si...@sfko.com> wrote:
> On Mon, Jun 7, 2010 at 9:23 PM, K Wong <wo...@gmail.com> wrote:
>> Did you install tomcat 5.5 from an RPM?
>
> I did not, on the advice of that same Solr wiki article that manual
> installation is "recommended because distribution Tomcats are either
> old or quirky." There haven't been any issues with this, except that
> the broken wiki is preventing me from getting to that script.
>
> (FWIW, I also installed Tomcat 6.)
>
> Sixten
>

Re: Tomcat startup script

Posted by Sixten Otto <si...@sfko.com>.
On Mon, Jun 7, 2010 at 9:23 PM, K Wong <wo...@gmail.com> wrote:
> Did you install tomcat 5.5 from an RPM?

I did not, on the advice of that same Solr wiki article that manual
installation is "recommended because distribution Tomcats are either
old or quirky." There haven't been any issues with this, except that
the broken wiki is preventing me from getting to that script.

(FWIW, I also installed Tomcat 6.)

Sixten

Re: Tomcat startup script

Posted by K Wong <wo...@gmail.com>.
I believe that I installed it simply by doing "yum install tomcat5"
then adjusting the "/sbin/chkconfig" settings.

Did you install tomcat 5.5 from an RPM?

Is it not showing up when you do

$ sudo /sbin/chkconfig --list tomcat5

K


On Mon, Jun 7, 2010 at 8:59 PM, Sixten Otto <si...@sfko.com> wrote:
> On Mon, Jun 7, 2010 at 2:35 PM, Chris Hostetter
> <ho...@fucit.org> wrote:
>> there is currently a bug with the apache wiki and attachments...
>> https://issues.apache.org/jira/browse/INFRA-2773
>
> Glad to know it's not just me.
>
> But does anyone have that script posted anywhere else?
>
> Sixten
>

Re: Tomcat startup script

Posted by Sixten Otto <si...@sfko.com>.
On Mon, Jun 7, 2010 at 2:35 PM, Chris Hostetter
<ho...@fucit.org> wrote:
> there is currently a bug with the apache wiki and attachments...
> https://issues.apache.org/jira/browse/INFRA-2773

Glad to know it's not just me.

But does anyone have that script posted anywhere else?

Sixten

Re: Tomcat startup script

Posted by Chris Hostetter <ho...@fucit.org>.
: So, looking at the wiki article on setting up Solr with Tomcat
: (http://wiki.apache.org/solr/SolrTomcat), there's a link to an
: attached init.d script for CentOS/RedHat/Fedora. Trouble is, the wiki

there is currently a bug with the apache wiki and attachments...

https://issues.apache.org/jira/browse/INFRA-2773



-Hoss