tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: how to bounce tomcat remote?
Date Wed, 06 Nov 2013 21:44:06 GMT
Hash: SHA256


On 11/6/13, 4:27 PM, Jay Vee wrote:
> Threaded messaging key:
>>> indicates my original post
>> indicates a reply
> NO > indicates my reply to the reply.
>>> On Nov 5, 2013, at 6:36 PM, Jay Vee <> 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?
> Yes of course, we are trying to automate the deployment of a .war, 
> bounce tomcat. This whole deployment pipeline thing just might
> catch on and we want to jump on the band wagon just in case it
> does.

Can I make a suggestion? Fix your web application so it can cleanly
un-deploy and re-deloy and then simply do a hot deployment? You can
even do that with zero downtime if you use parallel-deployment (read
about it in the Tomcat Users' Guide). You can even do all that
remotely via HTTP(S) using the Manager webapp.

>> 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.
> This is a no go. I am not in the sys admin department. If I ask
> them to configure SSH & sudo they will freak no matter how
> rationale my argument is. We have access to the machines with out
> exchange/ldap login and then we sudo su to root. So this is why I
> posted the question.

So, wait, let me get this straight: they won't let you use sudo
because sudo-to-root is already in use? That can't possibly be right.
Care to clarify?

>>> 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.
> I will look up the shutdown port. How would one programatically
> use the shutdown port to shut tomcat down?

All you have to do is connect to the shutdown port and send the
"shutdown string" (which can be found in server.xml... it defaults to
"SHUTDOWN"). You can do this trivially using telnet, netcat, etc. You
can also call " stop" and it will do that, too -- it
connects to the shutdown port and issues the shutdown string so you
only have to have read-access to CATALINA_BASE/conf/server.xml and it
will work no matter what user you are.

As Dan says, you will still have to figure out how to get Tomcat
started again...

>> The solution you're looking for here is going to be external to
>> Tomcat.
> Yes this is expected. (bounce tomcat remote). I am running a
> script on another box and want to bounce tomcat with a script
> (ant/maven or something else)

You're never going to be able to get Tomcat to come back up this way,
unless you have some other service that will allow you to
remotely-notify it that you want to bounce Tomcat, and then have that
process bounce Tomcat. For example, in a Windows environment, you
could use a remote Service command to tell a service to restart. Of
course, the service infrastructure has to have rights to stop/start
Tomcat so you are kind of back to where you started: you need
something like sudo access no matter what. (Unless you want to write a
user-level service that runs as tomcat_user and provides a similar
capability to that described above).

>> Commons Daemon would be the first thing to check out since it's 
>> included with Tomcat, but there are tons of other options.
> Awesome, I will check that out. But with commons-daemon, I would 
> think I still need ssh access as root to execute a script.

Yes, that's true. But you might not need to use sudo simply to send a
signal to the jsvc process.

- -chris
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message