Dmitry T. Dmitry T. - 4 months ago 15x
Bash Question

Chef run sh script

I have a problem trying to run shell script via Chef (with docker-provisioning).

This is how I try to execute my script:

bash 'shell_try' do
user "root"
run = "#{some_path_to_script}/ some_params"
code " #{run} > stdout.txt 2> stderr.txt"

(note that this script should run another scripts, processes and write logs)

Here's no errors in the output, but when I log into machine and run
ps aux
process isn't running.

I guess something wrong with permissions (or env variables), because when I try the same command manually - it works.


A bash resource just runs the provided script text directly, if you wanted to run a long-running process generally you would set up an Upstart or systemd service and use the service resource to start it.