Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Nikola Milutinovic

> Oh and you'll probably want to define:
> 
> JAVA_HOME
> CATALINA_HOME
> (or TOMCAT_HOME as appropriate)
> 
> directly inside of tomcat.sh or catalina.sh

Has anyone had problems with this? I'm experiencing startup problems. The script is 
all setup *that* way and running it manually when the system is in Run Level 3 starts 
it up, just fine. However, when system boots, Tomcat starts and keeps running for 5 to 
10 seconds, then it just plain exits. Nothing in error logs (except "catalina 
starting"), nothing on the console.

I will add that this is Tru64 UNIX 4.0D (Digital UNIX or DEC OSF/1) and I had problems 
with the startup scripts, due to some shell quirkiness. That has been resolved by some 
simple change in the scripts. Is it a problem for Catalina if it looses STDIN/STDOUT 
while attempting to startup? Because, that is the only big difference in boot startup 
and manual startup.

Nix.



Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Kevin HaleBoyes

The original message is at the end...

I'm using RedHat linux but I suspect the solution is very similar.

I've created a user tomcat4 in the already existing apache group.
Login is disabled for this user for security reasons.  The
jakarta-tomcat-4.0.3 directory is owned by root with 777 perms
on the work and logs subdirectories.  On further thought I suppose
I could have chown'd those directories to tomcat4.apache with 755
perms.

I've created a file /etc/sysconfig/tomcat4 as follows:

-%<--
export JAVA_HOME=/usr/java/j2sdk1.4.0

export CATALINA_BASE=/usr/local/jakarta/jakarta-tomcat-4.0.3
export CATALINA_HOME=$CATALINA_BASE
-%<--

This gets referenced/sourced in the init script which is
named /etc/rc.d/init.d/tomcat4.  It is heavily based on
the httpd init script.  It doesn't do status yet and the locking
hasn't been tested but it seems to work ok otherwise.

I then run 'chkconfig --add tomcat4' to install it in the proper
runlevel directories.  There may also be a problem with the
order on shutdown but I'm not sure.  I think I might be trying
to shutdown postgresql before tomcat which ends up blocking, so
the shutdown fails.  At least, I think that is what happens.  YMMV.

I ask one favour.  If you improve upon this script then please post
your changes as there has been a real lack of this sort of tomcat
infrastructure postings.  Now, I'm just as guilty since I meant to
post this long ago but ended up forgetting...

Kevin

-%<--
#!/bin/bash
#
# Startup script for the Apache Tomcat JSP/Servlet Container
#
# chkconfig: 345 85 15
# description: Apache Tomcat is a JSP/Servlet container.  It is used to serve \
#  JSP pages and "execute" servlets.
# processname: XXX - fixme - XXX
# pidfile: none
# lockfile: /var/lock/subsys/tomcat4
# config: $CATALINA_HOME/conf/server.xml
# config: /etc/sysconfig/tomcat4

# Source function library.
. /etc/rc.d/init.d/functions

# Source additional OPTIONS if we have them.
if [ -f /etc/sysconfig/tomcat4 ] ; then
. /etc/sysconfig/tomcat4
fi

prog=tomcat4

start() {
echo -n $"Starting $prog: "
#daemon $httpd `moduleargs` $OPTIONS
su tomcat4 ${CATALINA_HOME}/bin/catalina.sh start $2>&1
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat4
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
#killproc $httpd
su tomcat4 ${CATALINA_HOME}/bin/catalina.sh stop $2>&1
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat4 /var/run/tomcat4.pid
}
status() {
echo -n $"Status $prog: not implemented yet!"
echo
RETVAL=1
}

case "$1" in
  start)
start
;;
  stop)
stop
;;
  restart)
stop
sleep 20
start
;;
  *)
echo $"Usage: $prog {start|stop|restart}"
exit 1
esac

exit $RETVAL

-%<--



Original message follows:

Hi all,

Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server

Well my Tomcat engine is runnin' under a special user, let's say
wildcat.

I'm  looking for a way to automatically start this engine at system
boot, like i do with Apache.

Apache has a special way - start by root and change user to handle the
processes - to do the trick, but not Tomcat.

Does any one knows about a restriction to use smth like su wildtiger -c
'$TOMCAT_HOME/bin/startup.sh'...

Any suggestions welcome.

Jean-Luc :O)




__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Jean-Luc BEAUDET

Alexander ten Bruggencate a Ýcrit :

> On Thu, 2002-06-06 at 12:05, Jean-Luc BEAUDET wrote:
> > Hi all,
>
> > Well my Tomcat engine is runnin' under a special user, let's say
> > wildcat.
> >
> > I'm  looking for a way to automatically start this engine at system
> > boot, like i do with Apache.
> >
> > Jean-Luc :O)
>
> here's my /etc/rc.d/initd/tomcat script.
>
> to start oracle / tomcat / apache (in that order) with linux i just make
> symbollic links like:
>
> [/etc/rc.d/rc5.d] S82tomcat -> ../init.d/tomcat
>
> hope that helps...
> -Alexander.
>
> #!/bin/sh
> #
>
> # Source function library.
> . /etc/rc.d/init.d/functions
>
> # Source networking configuration.
> . /etc/sysconfig/network
>
> TOMCAT_HOME=/home/bruggenc/tomcat
> TOMCAT_OWNER=bruggenc
> export JAVA_HOME=/usr/java/j2sdk1.4.0
>
> if [ ! -f $TOMCAT_HOME/bin/startup.sh -o ! -d $TOMCAT_HOME ]; then
> echo "Tomcat startup: cannot start"
> exit
> fi
>
> # See how we were called.
> case "$1" in
>   start)
> echo -n "Starting Tomcat: "
> su - $TOMCAT_OWNER -c $TOMCAT_HOME/bin/startup.sh
> echo
> touch /var/lock/subsys/tomcat
> ;;
>   stop)
> # Stop daemons.
> echo -n "Shutting down Tomcat: "
> su - $TOMCAT_OWNER -c $TOMCAT_HOME/bin/shutdown.sh
> echo
> rm -f /var/lock/subsys/tomcat
> ;;
>   restart)
> $0 stop
> $0 start
> ;;
>   status)
> ;;
>   *)
> echo "Usage: tomcat {start|stop|restart|status}"
> exit 1
> esac
>
> exit 0
>
>   
>Name: signature.asc
>signature.asc   Type: application/pgp-signature
> Description: This is a digitally signed message part

Alexander,

It looks like exactly what i need.

Thank for all.

JL :O)



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Jean-Luc BEAUDET

Phillip Morelock a Ýcrit :

> su -c
>
> see
> man su
>
> Oh, wait, I see that you know that already --
>
> For me I had to symlink to tomcat.sh and init will automatically call it
> with "start" and "stop" arguments:
>
> tomcat.sh start
> and on shutdown:
> tomcat.sh stop
>
> which is essentially what startup.sh and shutdown.sh do.
>
> This worked for me on Linux, don't know Sun, sorry.
>
> cheers
> fillup
>
> On 6/6/02 3:05 AM, "Jean-Luc BEAUDET" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi all,
> >
> > Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server
> >
> > Well my Tomcat engine is runnin' under a special user, let's say
> > wildcat.
> >
> > I'm  looking for a way to automatically start this engine at system
> > boot, like i do with Apache.
> >
> > Apache has a special way - start by root and change user to handle the
> > processes - to do the trick, but not Tomcat.
> >
> > Does any one knows about a restriction to use smth like su wildtiger -c
> > '$TOMCAT_HOME/bin/startup.sh'...
> >
> > Any suggestions welcome.
> >
> > Jean-Luc :O)
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   
> > For additional commands, e-mail: 
> >
>
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

Thanks for yur help.

JL :O)



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Alexander ten Bruggencate

On Thu, 2002-06-06 at 12:05, Jean-Luc BEAUDET wrote:
> Hi all,

> Well my Tomcat engine is runnin' under a special user, let's say
> wildcat.
> 
> I'm  looking for a way to automatically start this engine at system
> boot, like i do with Apache.
> 
> Jean-Luc :O)

here's my /etc/rc.d/initd/tomcat script.

to start oracle / tomcat / apache (in that order) with linux i just make
symbollic links like:

[/etc/rc.d/rc5.d] S82tomcat -> ../init.d/tomcat 

hope that helps...
-Alexander.

#!/bin/sh
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

TOMCAT_HOME=/home/bruggenc/tomcat
TOMCAT_OWNER=bruggenc
export JAVA_HOME=/usr/java/j2sdk1.4.0

if [ ! -f $TOMCAT_HOME/bin/startup.sh -o ! -d $TOMCAT_HOME ]; then
echo "Tomcat startup: cannot start"
exit
fi

# See how we were called.
case "$1" in
  start)
echo -n "Starting Tomcat: "
su - $TOMCAT_OWNER -c $TOMCAT_HOME/bin/startup.sh
echo
touch /var/lock/subsys/tomcat
;;
  stop)
# Stop daemons.
echo -n "Shutting down Tomcat: "
su - $TOMCAT_OWNER -c $TOMCAT_HOME/bin/shutdown.sh
echo
rm -f /var/lock/subsys/tomcat
;;
  restart)
$0 stop
$0 start
;;
  status)
;;
  *)
echo "Usage: tomcat {start|stop|restart|status}"
exit 1
esac

exit 0




signature.asc
Description: This is a digitally signed message part


Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Phillip Morelock

Oh and you'll probably want to define:

JAVA_HOME
CATALINA_HOME
(or TOMCAT_HOME as appropriate)

directly inside of tomcat.sh or catalina.sh

cheers
fillup


On 6/6/02 3:17 AM, "Phillip Morelock" <[EMAIL PROTECTED]>
wrote:

> su -c
> 
> see
> man su
> 
> Oh, wait, I see that you know that already --
> 
> For me I had to symlink to tomcat.sh and init will automatically call it
> with "start" and "stop" arguments:
> 
> tomcat.sh start
> and on shutdown:
> tomcat.sh stop
> 
> which is essentially what startup.sh and shutdown.sh do.
> 
> This worked for me on Linux, don't know Sun, sorry.
> 
> cheers
> fillup
> 
> On 6/6/02 3:05 AM, "Jean-Luc BEAUDET" <[EMAIL PROTECTED]>
> wrote:
> 
>> Hi all,
>> 
>> Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server
>> 
>> Well my Tomcat engine is runnin' under a special user, let's say
>> wildcat.
>> 
>> I'm  looking for a way to automatically start this engine at system
>> boot, like i do with Apache.
>> 
>> Apache has a special way - start by root and change user to handle the
>> processes - to do the trick, but not Tomcat.
>> 
>> Does any one knows about a restriction to use smth like su wildtiger -c
>> '$TOMCAT_HOME/bin/startup.sh'...
>> 
>> Any suggestions welcome.
>> 
>> Jean-Luc :O)
>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:   
>> For additional commands, e-mail: 
>> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Phillip Morelock

su -c

see
man su

Oh, wait, I see that you know that already --

For me I had to symlink to tomcat.sh and init will automatically call it
with "start" and "stop" arguments:

tomcat.sh start
and on shutdown:
tomcat.sh stop

which is essentially what startup.sh and shutdown.sh do.

This worked for me on Linux, don't know Sun, sorry.

cheers
fillup

On 6/6/02 3:05 AM, "Jean-Luc BEAUDET" <[EMAIL PROTECTED]>
wrote:

> Hi all,
> 
> Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server
> 
> Well my Tomcat engine is runnin' under a special user, let's say
> wildcat.
> 
> I'm  looking for a way to automatically start this engine at system
> boot, like i do with Apache.
> 
> Apache has a special way - start by root and change user to handle the
> processes - to do the trick, but not Tomcat.
> 
> Does any one knows about a restriction to use smth like su wildtiger -c
> '$TOMCAT_HOME/bin/startup.sh'...
> 
> Any suggestions welcome.
> 
> Jean-Luc :O)
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Automatic start from /etc/rc3.d ???

2002-06-06 Thread Jean-Luc BEAUDET

Hi all,

Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server

Well my Tomcat engine is runnin' under a special user, let's say
wildcat.

I'm  looking for a way to automatically start this engine at system
boot, like i do with Apache.

Apache has a special way - start by root and change user to handle the
processes - to do the trick, but not Tomcat.

Does any one knows about a restriction to use smth like su wildtiger -c
'$TOMCAT_HOME/bin/startup.sh'...

Any suggestions welcome.

Jean-Luc :O)



--
To unsubscribe, e-mail:   
For additional commands, e-mail: