Hi I am trying to run the script but do not want to use the execute or script resource as it will execute every 30 mins also guards are blocked for my env .Hence need a help if we can re write the below code some other way without these resources.
Thanks in advance.
script 'user' do interpreter 'bash' user 'root' code <<-EOH adduser -g test1 test2 EOH end
this has to be written without execute or script resource.
and also second code being:
script 'executing_installation' do interpreter 'bash' user 'root' code <<-EOH sh /test/some/script/recipe.sh >> /tmp/test.txt EOH cwd /tmp/tmp2 end
script 'port_redirection' do interpreter 'bash' user 'root' code <<-EOH iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 chmod +x /etc/test/test1 EOH end
These has to be written without execute or script resource .
kindly help me on this with relevant example will be much help.
If you're using chef then you definitely want to be using Resources - what it sounds like you want is to only execute these resources once and you can use [guards](https://docs.chef.io/resource_common.html#guards) like `only_if` or `not_if`. Even if using the Mixlib:ShellOut it would run everytime if part of a recipe.