How to handle commands that hang on the remote end?

12 views
Skip to first unread message

Haani Niyaz

unread,
May 15, 2016, 10:23:51 PM5/15/16
to Capistrano
We have a use case where we want to run a service tomcat stop command and if it hangs run a kill -9 <pid> command. I'm unaware of ways to handle this in Capistrano. 
Has anyone solved a similar issue..? if so, can you please share methods, thanks.


Versions:
  • Ruby 2.1.1p76
  • Capistrano 3.4.0 



Lee Hambley

unread,
May 18, 2016, 12:46:56 PM5/18/16
to Capistrano
Hi Haani,

It's been 48 since your post, so I'm not sure if it's still relevant, however if tomcat is taking a long time to respond, there's not much Capistrano can do to handle that. 

The only real way is to make a command that backgrounds tomcat, collects it's PID and then signals it after a certain number of seconds, but it ends up being quite convoluted.

Bash's (assuming you're using the Bourne shell) FAQ #68 has a wealth of good information: http://mywiki.wooledge.org/BashFAQ/068




--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/57e83528-0b6e-455d-94ae-dd875c5a1937%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Haani Niyaz

unread,
May 18, 2016, 6:01:06 PM5/18/16
to Capistrano
Thanks Lee. It does seem like something that should be handled by the tomcat init script so I've resorted to doing just that.
Reply all
Reply to author
Forward
0 new messages