tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jm...@adobe.com
Subject Re: Basic questions
Date Sun, 12 Jan 2003 21:15:20 GMT
Hi there,

Paul's suggestion in #1 is probably the best way to go.. Here's a quick 
way to do it on solaris.

# add the user to the OS
useradd myuser

# switch to C-shell
/bin/csh

# run the following script

#!/bin/sh

JAVA_HOME=/usr/java
TOMCAT_HOME=/usr/local/tomcat

su - myuser -c "${TOMCAT_HOME}/bin/startup.sh"

a typical crontab entry

0 0 * * * cd /path/to/script ; ./restart_tomcat.sh > /var/log/myout.dat

which says run at midnight every day.

A couple of things, make sure that the myuser has the proper CLASSPATH 
settings and that it can find webserver.jar and servlet.jar and all 
other necessary JAR files (in this case I normally would create 
a .profile or .cshrc file in the user's home dir) and make sure that it 
owns the directories that it needs to write to such as work for example

There are probably more elegant ways to do this but that should get you 
started.

For your second question, Paul's suggestion abou the Controller servlet 
sounds very interesting... though I haven't tried that myself..

The simplest way I could think of is that you almost have to write a 
redirect servlet/snippet that will redirect based on the server 
time ... I know in Apache there is conditional re-writing like this... 
though it escapes me at the moment. please check httpd.apache.org and 
search for Rewrite Rules.. I think it was in their examples section if 
memory serves me right.

Hope that helps.

Jan-Michael

----- Original Message -----
From: Paul Yunusov <pyunusov@rogers.com>
Date: Saturday, January 11, 2003 12:43 pm
Subject: Re: Basic questions

> On Saturday 11 January 2003 03:34 pm, Denise Mangano wrote:
> > Hey all :)
> >
> > Throughout my learning experience with Tomcat, I have gotten 
> curious about
> > the following things.  This is mostly just for informational 
> purposes.> Inquiring minds want to know ; )
> >
> > #1:  Is it possible to set Tomcat to restart (as user tomcat) on a
> > schedule?
> >
> >
> > #2:  Is there anyway to set something up that if a user attempts 
> to access
> > my app within a specific time frame they are redirected to a 
> different> page. For example, when my user accesses my webapp they 
> go to
> > www.myhost.com/mywebapp and they are brought to index.jsp page.  
> However,> if the same exact URL is accessed within a specific time 
> frame, they would
> > be brought to index2.jsp.
> >
> > Thanks!
> >
> > Denise
> 
> Hi,
> 
> #1: It's OS-specific, and you can do it in a few ways, from 
> writing a shell 
> script to developing a native application. If you use UNIX, try 
> man crond at 
> the prompt.
> 
> #2: Have a Controller servlet that will forward (RequestDispatcher 
> comes to 
> mind) to different JSPs based on any criteria including time. Ah, 
> the 
> advantages of Model 2...
> 
> Paul
> 
> --
> 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