tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, John" <JTur...@AAS.com>
Subject RE: Start Apache/Jakarta-Tomcat as Non-root user
Date Tue, 01 Oct 2002 12:29:48 GMT

By "better off" using rc.local I meant a little bit of both.  Sometimes the
simplest way is the best way, especially if what you are trying to do is not
your core skill set.

The "correct" way is to use S and K scripts like you are trying to do.  The
goal, though, is to get the services started on boot, and that can be
accomplished just as easily by making calls to your scripts in rc.local,
especially if your processes require other services to start up first, since
rc.local is called last.  Some would even argue that rc.local is better from
the point of view that a sys-admin taking over the server would expect
non-default-install services to be started there anyway.  I know it's the
first place I'd look if I wanted to know how Tomcat (or anything else) was
started at boot on an unfamiliar machine, even though I would setup S and K
scripts myself.

In the end, use whatever works.

John

> -----Original Message-----
> From: Matt Raible [mailto:matt@raibledesigns.com]
> Sent: Monday, September 30, 2002 4:51 PM
> To: 'Tomcat Users List'
> Subject: RE: Start Apache/Jakarta-Tomcat as Non-root user
> 
> 
> I'm no linux expert, and I am trying to set this up on a production
> server that may have 1000+ users shortly.  To start apache, I'm using
> the rc.local file - and I'm having no luck with the following tomcat
> startup script.  Is it "bad" to use rc.local?  By "you'd probably be
> better off" - do you mean cause I don't appear to know what I'm doing
> ;-), or just because it's easier?
> 
> #!/bin/bash
> #
> # This script is for starting Tomcat automatically.
> # For use on RedHat Linux - tested on v7.3
> 
> CATALINA_HOME=/usr/local/tomcat; export CATALINA_HOME
> JAVA_HOME=/usr/java/j2sdk1.4.1; export JAVA_HOME
> 
> # source function library
> . /etc/rc.d/init.d/functions
> 
> RETVAL=0
> prog=tomcat1
> 
> case "$1" in
> start)
>         su tomcat /usr/local/tomcat1/bin/startup.sh
>         sleep 5
>         ;;
> stop)
>         su tomcat /usr/local/tomcat1/bin/shutdown.sh
>         ;;
> *)
>         echo "Usage: $0 {start|stop}"
>         exit 1
>         ;;
> esac
> 
> exit 0
> 
> > -----Original Message-----
> > From: Turner, John [mailto:JTurner@AAS.com] 
> > Sent: Monday, September 30, 2002 10:39 AM
> > To: 'Tomcat Users List'
> > Subject: RE: Start Apache/Jakarta-Tomcat as Non-root user
> > 
> > 
> > 
> > I'm not sure what you mean...you have to give it an argument, 
> > that's how the script is written.  Either start or stop.
> > 
> > Actually, now that I look at the script, there's a some stuff 
> > missing if you want to use it as a startup script in one of 
> > the rc.d directories. Something like:
> > 
> > # source function library
> > . /etc/rc.d/init.d/functions
> > 
> > RETVAL=0
> > prog="tomcat"
> > 
> > JAVA_HOME=/some/path/to/jdk
> > CATALINA_HOME=/some/path/to/tomcat
> > 
> > You'd probably be better off just putting a couple lines into 
> > rc.local,
> > like:
> > 
> > /some/path/to/tomcat/script start
> > 
> > John
> > 
> > 
> > > -----Original Message-----
> > > From: Matt Raible [mailto:matt@raibledesigns.com]
> > > Sent: Monday, September 30, 2002 12:29 PM
> > > To: 'Tomcat Users List'
> > > Subject: RE: Start Apache/Jakarta-Tomcat as Non-root user
> > > 
> > > 
> > > I've noticed that if I run ./S40tomcat, I have to add 
> > "start" after it 
> > > in order to get it to start from the command line.  Does 
> > the startup 
> > > script add this automatically?
> > > 
> > > > -----Original Message-----
> > > > From: Matt Raible [mailto:matt@raibledesigns.com]
> > > > Sent: Monday, September 30, 2002 8:12 AM
> > > > To: 'Tomcat Users List'
> > > > Subject: RE: Start Apache/Jakarta-Tomcat as Non-root user
> > > > 
> > > > 
> > > > I've modified your script for RedHat Linux 7.3, but my tomcat
> > > > instance still won't start on bootup.  I can execute 
> > > > ./S40tomcat, enter the tomcat user's password and everything 
> > > > works fine.  Any ideas or log files I can check?
> > > > 
> > > > #!/bin/bash
> > > > #
> > > > # Matt Raible 29 Sep 2002
> > > > # For use on RedHat Linux - tested on v7.3
> > > > 
> > > > case "$1" in
> > > > start)
> > > >         su tomcat /usr/local/tomcat1/bin/startup.sh
> > > >         sleep 5
> > > >         ;;
> > > > stop)
> > > >         su tomcat /usr/local/tomcat1/bin/shutdown.sh
> > > >         ;;
> > > > *)
> > > >         echo "Usage: $0 {start|stop}"
> > > >         exit 1
> > > >         ;;
> > > > esac
> > > > 
> > > > exit 0
> > > > 
> > > > 
> > > > > -----Original Message-----
> > > > > From: Jim Coble [mailto:Jim.Coble@duke.edu]
> > > > > Sent: Saturday, September 28, 2002 8:11 AM
> > > > > To: Tomcat Users List
> > > > > Subject: Re: Start Apache/Jakarta-Tomcat as Non-root user
> > > > > 
> > > > > 
> > > > > I accomplished this yesterday on Solaris 8 using the
> > > > following script
> > > > > called at system startup (linked to S40tomcat in rc3.d)
> > > > ... Replace
> > > > > "tomcat" after the two su commands with the user you want
> > > > > Tomcat to run as 
> > > > > and, of course, change the paths as appropriate for your 
> > > > > system.  You'll 
> > > > > also need to make sure your tomcat user has appropriate 
> > > > > permissions on 
> > > > > your tomcat directories.
> > > > > --Jim
> > > > > 
> > > > > #!/sbin/sh
> > > > > #
> > > > > # Jim Coble 09 Jun 02
> > > > > # Modified 27 Sep 02 to try to get to run as user tomcat
> > > > >  
> > > > > CATALINA_HOME=/usr/local/tomcat;export CATALINA_HOME 
> > > > > JAVA_HOME=/usr/java;export JAVA_HOME
> > > > >  
> > > > > case "$1" in
> > > > > start)
> > > > >         su tomcat /usr/local/tomcat/bin/startup.sh
> > > > >         sleep 5
> > > > >         ;;
> > > > > stop)
> > > > >         su tomcat /usr/local/tomcat/bin/shutdown.sh
> > > > >         ;;
> > > > > *)
> > > > >         echo "Usage: $0 {start|stop}"
> > > > >         exit 1
> > > > >         ;;
> > > > > esac
> > > > >  
> > > > > exit 0
> > > > > 
> > > > > ==================================
> > > > > Jim Coble
> > > > > Senior Technology Specialist
> > > > > Center for Instructional Technology
> > > > > Email: jim.coble@duke.edu
> > > > > Voice: 919-660-5974  Fax: 919-660-5923
> > > > > Box 90198, Duke University
> > > > > Durham, NC 27708-0198
> > > > > ==================================
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Lars Nielsen Lind <moonie@worldonline.dk>
> > > > > 09/28/2002 10:12 AM
> > > > > Please respond to "Tomcat Users List"
> > > > > 
> > > > >  
> > > > >         To:     tomcat-user@jakarta.apache.org
> > > > >         cc: 
> > > > >         Subject:        Start Apache/Jakarta-Tomcat as 
> > > Non-root user
> > > > > 
> > > > > 
> > > > > Hi.
> > > > > 
> > > > > Are the some easy ways to start Apache / Jakarta-Tomcat as 
> > > > > Non-root user
> > > > > - for instance with a  user created for the purpose?
> > > > > 
> > > > > Are the any security risks (for instance access to 
> root) to be 
> > > > > aware of?
> > > > > 
> > > > > Best regards,
> > > > > 
> > > > > Lars Nielsen Lind
> > > > > 
> > > > > 
> > > > > --
> > > > > To unsubscribe, e-mail:   
> > > > > <mailto:tomcat-user-> unsubscribe@jakarta.apache.org>
> > > > > For
> > > > > additional commands,
> > > > > e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: 
> > <mailto:tomcat-user-help@jakarta.apache.org>
> > 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message