1

在 cloud66 部署到 digitalocean 期间,尝试使用部署挂钩授予 /public/uploads 权限,以使carrierwave文件上传工作。我收到以下错误:

Error during deployment: Error during after_rails hook: Execution of sudo 
/tmp/open_folder_permissions.sh returned a non-zero exit code. Output was: 
/tmp/open_folder_permissions.sh:5: syntax error, unexpected tGVAR, expecting keyword_do or 
'{' or '(' sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads ^ 

open_folder_permissions.sh

#! /usr/bin/env ruby
#load environment variables
source /var/.cloud66_env
#assign desired permissions
sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads

deploy_hooks.yml

production:
  after_rails:
    - source: /.cloud66/files/open_folder_permissions.sh
      destination: /tmp/open_folder_permissions.sh
      target: rails                
      execute: true
      run_on: all_servers
      apply_during: all
      sudo: true

什么可能导致错误?

4

1 回答 1

2

open_folder_permissions.sh不包含有效的 Ruby 代码。从外观上看,它应该是一个 shell 脚本,而不是 Ruby 脚本,因此您应该将 shebang 行更改为 shell 解释器而不是 Ruby 解释器。

#! bin/bash是正确的翻译。

于 2013-06-09T04:25:15.027 回答