[chef] Re: Re: knife ssh not keeping the process live


Chronological Thread 
  • From: Morgan Blackthorne < >
  • To: " " < >
  • Subject: [chef] Re: Re: knife ssh not keeping the process live
  • Date: Thu, 24 Oct 2013 20:40:54 -0700

Hit enter too soon; what I meant to add was that in your script you should try doing something like:

nohup ./startup.sh &

That should ensure that when it gets backgrounded and the ssh session terminates that Tomcat is not killed by the shell.

--
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS


On Thu, Oct 24, 2013 at 8:39 PM, Morgan Blackthorne < " target="_blank"> > wrote:
It's unclear from your post whether those steps are being called from Chef via a script which performs them, or directly via Chef (ie, multiple execute blocks). If it's the latter, I would suggest externalizing it into a script and having Chef execute that.

--
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS


On Thu, Oct 24, 2013 at 6:58 PM, Luis Mondesi < " target="_blank"> > wrote:

> On Oct 24, 2013, at 18:00, Manoj Thakkar < " target="_blank"> > wrote:
>
> Hi All,
>
> I have a chef recipe which does something like this
>
> cd  tomcat/bin
> ./shutdown.sh
> sleep 10
> ./startup.sh
>
> when i run it on the node chef-client -o "recipe[tomcat]"it works fine ,
>
> but when i call knife ssh "role[tomcat]" "chef-client -o "recipe[tomcat]"  the tomcat come up and then shutdown itself,
>
> i thought its something to do with ssh and starting a new shell so i tried ./startup.sh &   in the recipe
>
> but that also did not help, pls help i think i understand the issue being a new shell spawned and killed, but i dont understand why even if i put the process in background also what's the workaround for it.
>

You're assuming that tomcat is daemonizing but it seems the task is running with some option that prevents it from forking and leaving the current shell (so it's parent ID process is init)

Check startup.sh and make sure the command is run without debug or "no fork" or whatever equivalent option tomcat uses. It might be as simple as "write output to stdout" and when your shell exits the task dies. (broken pipe)

Hope that helps

Regards,

--
A bug magnet





Archive powered by MHonArc 2.6.16.

§