3

All I've found about this is: https://forums.aws.amazon.com/thread.jspa?threadID=112988

I know that I can do this:

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

But can I do this?

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

And do I still need the && to separate the commands or are they executed as separate commands? or is it still only one command?

Michael Wiles
  • 20,902
  • 18
  • 71
  • 101

1 Answers1

5

This can be done via YAML's literal block scalar, as follows:

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

More documentation on the same can be found here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-commands-options

Kunal Nagpal
  • 776
  • 2
  • 7
  • 14
  • thanks... that is a very nifty solution. I went with a multi line command ala (separated by ;) - (\n = line feed as you can't have line feeds in comments) 07_run_command: \n mkdir -p /var/cache/tomcat8/temp/.m2/repository; \n chmod 777 \n but this solution is far more elegant. – Michael Wiles Oct 23 '18 at 07:41