【问题标题】:Can I put a eb extension container command on multiple lines and if I can how?我可以在多行上放置一个 eb 扩展容器命令吗?如果可以的话?
【发布时间】:2019-03-21 23:17:10
【问题描述】:

我找到的所有信息都是:https://forums.aws.amazon.com/thread.jspa?threadID=112988

我知道我可以做到:

container_commands:
   07_run_command:
      "mkdir -p /var/cache/tomcat8/temp/.m2/repository && chmod 777"

但是我可以这样做吗?

container_commands:
   07_run_command:
      mkdir -p /var/cache/tomcat8/temp/.m2/repository && 
      chmod 777

我还需要 && 来分隔命令还是将它们作为单独的命令执行?还是仍然只有一个命令?

【问题讨论】:

    标签: amazon-web-services amazon-elastic-beanstalk ebextensions


    【解决方案1】:

    这可以通过 YAML 的文字块标量来完成,如下所示:

    container_commands:
      07_run_command: |
          mkdir -p /var/cache/tomcat8/temp/.m2/repository
          chmod 777
    

    更多相关文档可以在这里找到:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-commands-options

    【讨论】:

    • 谢谢...这是一个非常好的解决方案。我使用了多行命令 ala(由 ; 分隔)-(\n = 换行,因为您不能在 cmets 中使用换行)07_run_command: \n mkdir -p /var/cache/tomcat8/temp/.m2/存储库; \n chmod 777 \n 但这个解决方案要优雅得多。
    猜你喜欢
    • 2019-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多