tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: how to bounce tomcat remote?
Date Wed, 06 Nov 2013 15:19:56 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dan,

On 11/6/13, 9:16 AM, Daniel Mikusa wrote:
> On Nov 5, 2013, at 6:36 PM, Jay Vee <jvsrvcs@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.

+1

Sudo can be configured to allow a single user the ability to run a
single command as another user. So you set up a user called
tomcat_restart and give them a single command they can execute via sudo:

  sudo -u tomcat_user /path/to/restart_script.sh

>> 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.

+1

> 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/

commons-daemon also knows how to "bounce" Tomcat with a single command
(I believe you can send a SIGUSR1 signal, but I can't seem to find a
reference in the documentation for that).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSel4cAAoJEBzwKT+lPKRYusMP/i1F7z4XPfBN99ov4pee8oat
cG9EGEjKYjSysqqmpGtSBEC5fFaT4gk7+SWXMor0cbUKxnU1t8SmqipE/i51leDO
9oX9ygplqhdzpOgbOqIKld88tbd/8ti+y2Wnq34NmdBH35zvmnZQPeiW9/6DBffX
lYce29M9dWSSJZ9hZ4D5GMa6Mlw0cJu2Y5JzlXbHnAASGuj+6FUXQbtXj9lE54FA
qMEBWMvRsJRi2fJUZbM3BvUE94znmdb0bHO0mgMGMfFIAecwUQ3HOofdtJKtr3dO
jmy1edFqX7aCuQrGLSqOpq0TEqnJpKLHlDdH87BFif7kUHrVng+ujMjx/tlYaq0L
mcg/Fw3znWWkwqRXn2XQYBDn8oKYMFlFyn6htZkIzGrbJYysWHwazWgU2A+09VKz
eXmZNQ58/5gVGGwc2J7oPiQOxNqYh6JAhYg+B+ycoHTsFA0n/4ooGwAXmHjmZyL1
206VrwHburJ7+xXMe9vbHFOVxhI3dl5kH7jXpywJp14Yhv91zuD+0Qm45sq+IYml
NF6nYqx4k2IP0r0SFbQAZXTqKRxmod/YkJjinImu8gSqIvOPC9DSzhgCweGr4ugn
6zY0m0Fdf2ZWC9gWkyfViuvbAfWzl+Qw2/4UsK0O7pOmp341T2RvYGMUdze2ZtCF
HISb1kAbEuVKpjCA8ZdU
=+CNs
-----END PGP SIGNATURE-----

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


Mime
View raw message