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