tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shaw, Ray V CTR (US)" <ray.v.shaw....@mail.mil>
Subject Issue with sudo + init script
Date Wed, 01 Aug 2012 17:10:50 GMT
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).

Thanks,

--Ray

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


Mime
View raw message