Now, after running chef-client tempalte file /tmp/export_env.sh is getting generated in my server but how do I run shell script file “/tmp/export_env.sh” immediately after template getting created. After generating template file I do not want to run that file “/tmp/export_env.sh” manually in order to set env variable and change permission.
Actually the issue here is if I have kept the attributes in .erb file and if I run chef-client as root generate template file should have been executed by default or do I need to write something to make it run?
If it should be running by default what is the issue in my recipe and if I need to write something to make it running can you suggest .
I am still not entirely sure what you use case is. What I can tell you is that chef does not “run” anything by rendering a template. The template resource only places the file on your disk and sets permissions etc. If you want to run the script you will have to use the execute resource: https://docs.chef.io/resource_execute.html