Following the answer here, I have the following for deployment:
$ ls -alh /etc/init.d
# unicorn_init_include.sh -> /home/deployer/abc/current/config/unicorn_init_include.sh
# unicorn_abc -> /home/deployer/abc/current/config/unicorn_init_staging.sh
# /home/deployer/abc/current/config/unicorn_init_staging.sh
#!/bin/sh
RAILS_ENV="staging"
export RAILS_ENV
unicorn_init_include.sh
# /home/deployer/abc/current/config/unicorn_init_include.sh
#!/bin/sh
set -e
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/deployer/abc/current
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E $RAILS_ENV"
You will notice it's all symlinked when I deploy:setup
with Capistrano:
executing "sudo -p 'sudo password: ' ln -nfs /home/deployer/abc/current/config/unicorn_init_staging.sh /etc/init.d/unicorn_abc"
servers: ["192.168.33.10"]
[192.168.33.10] executing command
[out :: 192.168.33.10]
command finished in 611ms
executing "sudo -p 'sudo password: ' ln -nfs /home/deployer/abc/current/config/unicorn_init_include.sh /etc/init.d/unicorn_init_include.sh"
servers: ["192.168.33.10"]
[192.168.33.10] executing command
[out :: 192.168.33.10]
command finished in 602ms
But when Capistrano tries to fire the command:
** [out :: 192.168.33.10] /etc/init.d/unicorn_abc: 4: /etc/init.d/unicorn_abc:
** [out :: 192.168.33.10] unicorn_init_include.sh: not found
I have tried changing the unicorn_init_include.sh
in the unicorn_init_staging.sh
to ./unicorn_init_include.sh
, symlinked the unicorn_abc
to /etc/init.d/
(as shown above), but it doesn't work.
What have I done wrong?