Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D6DC9EF2 for ; Thu, 2 Aug 2012 07:26:12 +0000 (UTC) Received: (qmail 55700 invoked by uid 500); 2 Aug 2012 07:26:08 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 55484 invoked by uid 500); 2 Aug 2012 07:26:07 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 55453 invoked by uid 99); 2 Aug 2012 07:26:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2012 07:26:07 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2012 07:25:59 +0000 Received: from [192.168.245.129] (p549E8FFB.dip0.t-ipconnect.de [84.158.143.251]) by tor.combios.es (Postfix) with ESMTPA id 12723DA0767 for ; Thu, 2 Aug 2012 09:25:36 +0200 (CEST) Message-ID: <501A2B64.7070602@ice-sa.com> Date: Thu, 02 Aug 2012 09:25:24 +0200 From: =?ISO-8859-1?Q?Andr=E9_Warnier?= Reply-To: Tomcat Users List User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Issue with sudo + init script References: <517F37858E593249B11B9B7B6BA732072ED7B21D@umechphd.easf.csd.disa.mil> <50197980.5090101@mayr-stefan.de> In-Reply-To: <50197980.5090101@mayr-stefan.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Stefan Mayr wrote: > Am 01.08.2012 19:10, schrieb Shaw, Ray V CTR (US): >> 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). >> > > Could you post your tomcat output when you try to start it? You should > also check differences in your environment variables when using > different methods. > I have not really worked this out in detail, but something up there is making me suspicious : you are not exporting $CATALINA_HOME, and you are using one additional level of quotes in your start command, as compared to your stop command. Are you sure that when the start command actually runs, it sees the same CATALINA_HOME value ? --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org