Dmitry T. Dmitry T. - 1 year ago 210
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download