I'm having some trouble with this bash script, which I intend to use as a startup script for a web server running nginx+unicorn.
DAEMON='/bin/su - deployer -c "/home/deployer/.rvm/gems/ruby-1.9.3-p125/bin/unicorn -c /home/deployer/apps/myapp/current/config/unicorn.rb -E production -D"'
Error:
/bin/su: invalid option -- 'E'
I need to run the script as the user deployer, but I am uncertain how to pass all my command to /bin/su. I'm sure this is a simple escaping error but after trying several different ways of escaping it but I am just not getting this right. Thanks.
eval "$DAEMON"to get it to work, and everyone hates evaling code, (its a big security risk). Good luck.