douqin6785 2014-12-03 13:15
浏览 69
已采纳

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

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条回答 默认 最新

  • duanfu7004 2014-12-03 15:34
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!