On Tue, Feb 4, 2014 at 6:22 PM, Franz <169...@gmail.com> wrote:

> > I assume you followed instructions for installation:
> >
> >
> http://sourceforge.net/projects/openemm/files/OpenEMM%20documentation/Documentation%20(latest%20versions)
> >
>
> >
> > After you get it working with catalina.sh run, you probably want to do
> the
> > following as well:
> > 1) setup JAVA_HOME somewhere in the profile scripts (e.g. create
> > /etc/profile.d/java.sh file)
> >
>
> yes, unfortunately openemm tutorial says nothing about that.  Now there is
> not java.sh file there. So you mean creating a java.sh file with inside
> only:
>
> export JAVA_HOME=/opt/openemm/java
>
>
Yes, something along those lines.

Edit a new file in /etc/profile.d/java.sh, e.g.

#
# /etc/profile.d/java.sh
#
export JAVA_HOME=/opt/openemm/java
export PATH=${PATH}:${JAVA_HOME}/bin

- This script does two things:
1) sets $JAVA_HOME for your JDK
2) updates $PATH so your $JAVA_HOME/bin is on the PATH (i.e. Java can be
invoked from any directory)


> and what does it? Does it setup JAVA_HOME once and for all?
>
> 2) configure tomcat as a centos service (chkconfig+rc.d script), so it
> > starts up automatically when you reboot your system.
> >
>
> This seems complicated too.   Does it means preparing a file tomcat.sh in
> /etc/rc.d containing:
>
> /opt/openemm/tomcat/bin/startup.sh
>
>
Yes, something like that ...

1. Create /etc/rc.d/init.d/tomcat.sh  (I will see to find some examples),
here's a minimal example:

#!/bin/bash
#
# /etc/rc.d/init.d/tomcat.sh
#
# description: Tomcat Startup, Stop, Restart Script
# processname: tomcat
# chkconfig: 234 20 80

# Test if JAVA_HOME is already set
if [ "x$JAVA_HOME" = "x" ]
then
  export JAVA_HOME=/opt/openemm/java
  export PATH=$PATH:$JAVA_HOME/bin
fi

# Set Tomcat home directory
CATALINA_HOME=/opt/openemm/tomcat

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

- here you would probably want to add a more sophisticated script that adds
/var/run/tomcat/id PID file, kills process if it hangs, etc...
- Can anyone else provide some of their example scripts?

2. Add a tomcat service, e.g.

  chkconfig -add tomcat
  chkconfig tomcat on

3. Test your service, e.g.

service tomcat stop
service tomcat start
service tomcat restart

Reply via email to