Amazon web services 从.ebextensions文件夹复制文件
我想从.ebextensions/td-agent.conf文件到/etc/td-agent/td-agent.conf文件。但它不起作用,并且在误差以下 如果您看到附加的图像,.ebextensions中有3个文件。我已将copy命令放在01-main.config中Amazon web services 从.ebextensions文件夹复制文件,amazon-web-services,amazon-elastic-beanstalk,ebextensions,Amazon Web Services,Amazon Elastic Beanstalk,Ebextensions,我想从.ebextensions/td-agent.conf文件到/etc/td-agent/td-agent.conf文件。但它不起作用,并且在误差以下 如果您看到附加的图像,.ebextensions中有3个文件。我已将copy命令放在01-main.config中 --- container_commands: 01_cron_job: command: "touch /tmp/is_leader" leader_only: true 01_tdconfc
---
container_commands:
01_cron_job:
command: "touch /tmp/is_leader"
leader_only: true
01_tdconfcopy_job:
command: "yes | cp .ebextensions/td-agent.conf /etc/td-agent/td-agent.conf"
错误如下所示
Command failed on instance. Return code: 1 Output: cp: cannot create regular file '/etc/td-agent/td-agent.conf': No such file or directory
问题是您正在将文件复制到一个不存在的目录。您应该首先创建输出目录,然后复制配置文件 因此,这将是:
---
container_commands:
01_cron_job:
command: "touch /tmp/is_leader"
leader_only: true
01_create_dir:
command: "sudo mkdir -p /etc/td-agent/"
02_tdconfcopy_job:
command: "yes | cp .ebextensions/td-agent.conf /etc/td-agent/td-agent.conf"
或者,您可以使用files
命令直接在服务器上创建文件
files:
"/etc/td-agent/td-agent.conf":
mode: "000644"
owner: root
group: root
content: |
content of your config file that you want to copy
问题是您正在将文件复制到一个不存在的目录。您应该首先创建输出目录,然后复制配置文件 因此,这将是:
---
container_commands:
01_cron_job:
command: "touch /tmp/is_leader"
leader_only: true
01_create_dir:
command: "sudo mkdir -p /etc/td-agent/"
02_tdconfcopy_job:
command: "yes | cp .ebextensions/td-agent.conf /etc/td-agent/td-agent.conf"
或者,您可以使用files
命令直接在服务器上创建文件
files:
"/etc/td-agent/td-agent.conf":
mode: "000644"
owner: root
group: root
content: |
content of your config file that you want to copy
是的,这是一种方式。但我们必须有办法复制文件,随着时间的推移,文件的内容可能会越来越大。@jaishreimhra,我已经更新了答案。复制失败,因为
/etc/td-agent/
不存在,应该先创建。是的,这是一种方法。但我们必须有办法复制文件,随着时间的推移,文件的内容可能会越来越大。@jaishreimhra,我已经更新了答案。复制失败,因为/etc/td-agent/
不存在,应该先创建。