按照这里的答案,我有以下部署:
$ 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"
当我deploy:setup
使用 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
但是当 Capistrano 尝试触发命令时:
** [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
我曾尝试更改tounicorn_init_include.sh
中的unicorn_init_staging.sh
to ./unicorn_init_include.sh
,符号链接unicorn_abc
to /etc/init.d/
(如上所示),但它不起作用。
我做错了什么?