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 ...

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

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记