2012/8/1 Shaw, Ray V CTR (US) <ray.v.shaw....@mail.mil>:
> I'm starting up Tomcat 7.0 on RHEL6 with the following init script:
>
> #!/bin/bash
> #
> # chkconfig: 235 80 20
> # description: Takes care of starting and stopping Tomcat.
>
> CATALINA_HOME="/opt/tomcat7"
> export JAVA_HOME="/usr/java/jdk6-64/"
>
> case "$1" in
>         'start')
>                 /bin/su tomcat -c "$CATALINA_HOME/bin/startup.sh -security"
>                 ;;
>         'stop')
>                 /bin/su tomcat -c $CATALINA_HOME/bin/shutdown.sh
>                 ;;
>         *)
>                 echo "usage: $0 {start|stop}"
>                 ;;
> esac
>
> If I use sudo -s (or -i) to get a root shell, I can use this script to start 
> and stop Tomcat.
>
> If I invoke this script directly via sudo, i.e. "sudo /sbin/service tomcat7 
> stop", stopping Tomcat works.  Starting does not; Tomcat gives the usual 
> output to the terminal, creates or touches catalina.out (but writes nothing 
> to it), and then instantly exits.  This is a problem, because I need to allow 
> the Web admin to start/stop Tomcat without giving them everything.
>
> Has anyone seen anything similar to this before?  /var/log/secure isn't 
> showing anything out of the ordinary (and obviously, the commands are being 
> run).


Note that calling startup.sh and shutdown.sh  is just a wrapper for
calling catalina.sh with arguments "start" and "stop" respectively.
I'd recommend co call catalina.sh directly instead of those wrapper
scripts.

Either java fails to start (and catalina.out is opened by shell as the
output stream of that process - it has nothing to do with Tomcat
itself),  or it terminates when its parent process terminates due to
HUP signal.

To exclude the former, try replace your command with "catalina.sh run
-security", so that Tomcat starts interactively in the same shell.

To exclude the later, maybe you should use "nohup" program to launch
catalina.sh.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to