【问题标题】:how to set change directory to one where PHP app exists on Amazon Elastick Beanstack in post deployment script如何在部署后脚本中将更改目录设置为 Amazon Elastic Beanstalk 上存在 PHP 应用程序的目录
【发布时间】:2015-02-01 01:46:43
【问题描述】:

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

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

EB扩展文件:

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

错误日志:

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

【问题讨论】:

    标签: php deployment amazon amazon-elastic-beanstalk


    【解决方案1】:

    您需要指定完整路径:
    ... chmod 777 /var/app/current/wp-content/plugins/wp-scss/cache ...

    【讨论】:

      猜你喜欢
      • 2016-03-17
      • 2016-07-08
      • 2014-03-31
      • 2013-06-25
      • 2014-11-09
      • 2020-09-29
      • 2016-02-17
      • 2012-07-04
      • 2014-04-12
      相关资源
      最近更新 更多