If you want to run any java stuff, you can use the execute resource, which allows passing environment variables as hash (JAVA_HOME and PATH) in your case.
You can use the same resource or bash resource to read profile.sh and then execute the command as a single step using the && bash hack, but that will be ugly :-(
On Dec 16, 2014 2:52 AM, "Amandeep" < " target="_blank"> > wrote:Thanks Morgan. I am writing my own cookbook currently where i am setting java home and path variable in .profile as well as /etc/profile file so that when these files are executed then automatically env variables will be set.RegardsAmandeep SinghSent from my iPhoneYou don't execute .profile. If you're in a shell and need to reload the file you can do ", ~/.profile" but that is a shell built-in, it's not a command. Typically commands without a TTY won't load the .profile/etc files, unless the command is a shell script or you explicitly call the shell to run the command.If you're having trouble running scripts via Chef, you'll need to paste at least the error that occurs for us to help.Also, why not just use the existing community java cookbook (https://github.com/agileorbit-cookbooks/java)? ISTR that has settings to configure JAVA_HOME via an /etc/profile.d file.--~*~ 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/Ps3uSSOn Tue, Dec 16, 2014 at 1:55 AM, Amandeep < " target="_blank"> > wrote:Hi team,
I have created a cookbook for java installation and adding java home into path environment variable and exporting the variables by executing the .profile file.
I am not able to execute .profile file as well as any sh file.
Please help in this. If my recipe code is required then i will paste it here.
Regards
Amandeep Singh
Archive powered by MHonArc 2.6.16.