On Nov 5, 2013, at 6:36 PM, Jay Vee <jvsr...@gmail.com> wrote:

> I need to bounce tomcat (run a stop, startup script) but from a remote
> machine.
> 
> SSH will not work.
> 
> Tomcat runs as 'tomcat_user' and this user is not a ssh user so we cannot
> ssh into a box using this user.
> 
> We have to ssh into the box with our exchange credentials and then $sudo su
> - tomcat _user
> to do the startup / shutdown.

Why does this not work?  Are you trying to automate the process in some way?

If so, maybe look at configuring SSH & sudo.  They are pretty flexible.  For 
example, you could enable key based authentication (i.e. password-less login) 
for your SSH user and configure sudo to allow your user to run the startup / 
shutdown scripts without a password.  With that you could do a one command 
restart.

> Is there any other way to programatially stop/start comcat?  

There's the shutdown port (or perhaps System.exit() called from an app), but 
that's just to stop Tomcat.  Once it's stopped you'd need to start it again 
somehow.

The solution you're looking for here is going to be external to Tomcat.  Tomcat 
cannot restart itself because once Tomcat's process exits, its code is no 
longer running.  Thus there is nothing to trigger it to start again.  You need 
something outside of Tomcat like a script, monitoring utility or service daemon 
to do a true restart.

Commons Daemon would be the first thing to check out since it's included with 
Tomcat, but there are tons of other options.

  https://commons.apache.org/proper/commons-daemon/

Dan

> Ideally I would like to do this with gradle but there is no plugin so far:
> 
> gradle tomcat plugin ( only works on a local tomcat, not a remote )
> gradle cargo plugin ( does not have a task that will stop & restart tomcat)
> 
> Unfortunately gradle is a bit lacking at the moment, ideally a single call
> to a gradle or ant task would be nice to bounce the server ( from a remote
> machine ).
> 
> thanks
> 
> 
> J.V.


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

Reply via email to