如何在部署后脚本中将更改目录设置为Amazon Elastick Beanstack上存在PHP应用程序的目录

我为Amazon Elastick Beanstack上现有的PHP app创建了部署后脚本。 该脚本在远程计算机上正常启动,但当前目录可能不是应用程序所在的目录。</ p>

如何更改路径以获取Amazon Elastick Beanstack实例上安装PHP应用程序的位置?< / p>

EBextension文件:</ p>

 命令:
create_post_dir:
命令:“mkdir / opt / elasticbeanstalk / hooks / appdeploy / post”

ignoreErrors:true
files:
“/ opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh":
mode:”000755“
owner:root
group:root
content:| \ n#!/ usr / bin / env bash
#cd $ EB_CONFIG_APP_CURRENT
chmod 777 wp-content / plugins / wp-scss / cache
chmod 777 wp-content / themes / XXXX / css
</ code> </ pre>

错误日志:</ p>

  2014-12-03T12:59:43.642Z] ERROR [22868]:命令执行失败:[  CMD-AppDeploy / AppDeployStage1 / AppDeployPostHook / 99_change_access_rights.sh]命令失败,错误代码为1:/ opt / elasticbeanstalk / hooks / appdeploy / post / 99_change_access  _rights.sh 
chmod:无法访问âwp-content / plugins / wp-scss /cacheâ:没有这样的文件或目录
chmod:无法访问âwp-content / themes / XXXXX /cssâ:没有这样的文件或目录(ElasticBeanstalk :: ActivityFatalError )
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.0/lib/elasticbeanstalk/activity.rb:189:in,scue in exec'
。 ..
caused by:命令失败,错误代码为1:/opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh

</ div>

展开原文

原文

I created post deployment script for PHP app existing on Amazon Elastick Beanstack. The script is started properly on remote machine, but probably the current directory is not one where application exists.

How to change path to get where PHP application is installed on Amazon Elastick Beanstack instance?

EBextension file:

commands:
  create_post_dir:
    command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
    ignoreErrors: true
files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      # cd $EB_CONFIG_APP_CURRENT
      chmod 777 wp-content/plugins/wp-scss/cache
      chmod 777 wp-content/themes/XXXX/css

The error logs:

2014-12-03T12:59:43.642Z] ERROR [22868] : Command execution failed: [CMD-AppDeploy/AppDeployStage1/AppDeployPostHook/99_change_access_rights.sh] command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh
chmod: cannot access âwp-content/plugins/wp-scss/cacheâ: No such file or directory
chmod: cannot access âwp-content/themes/XXXXX/cssâ: No such file or directory (ElasticBeanstalk::ActivityFatalError)
    at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.0/lib/elasticbeanstalk/activity.rb:189:in `rescue in exec'
    ...
caused by: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/post/99_change_access_rights.sh

1个回答



您需要指定完整路径:


...
chmod 777 / var /app/current/wp-content/plugins/wp-scss/cache
...


</ div>

展开原文

原文

you'll need to specify the full path:
... chmod 777 /var/app/current/wp-content/plugins/wp-scss/cache ...

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐