跳至内容

how to echo commands executed by cfn-init ?

0

Hi,

I have an AWS::CloudFormation::Init section and a configSet containing a config key with some commands, one failed for a shell syntax issue but I did not find the problem and I would like to show the command executed by cfn-init.

Cfn-init logs are in the /var/log folder, the -v option prints the command outputs in the log files cfn-init-cmd.log or cfn-init-cmd.log but these files do not contain the commands executed.

Is there a way to display executed commands?

Sincerly

已提问 3 年前884 查看次数
1 回答
0

How about "echo `command` >> text.txt" to describe the result of the command execution?

专家
已回答 3 年前
  • my point is to have somewhere the command executed by cfn-init. Two examples.

    If the command written in the stack file is "curl -k -s --request GET --header \"PRIVATE-TOKEN= qqqqq\" --url '<one url>' I would like to get in the log the command : curl -k -s --request GET --header "PRIVATE-TOKEN= qqqqq" --url '<one url> ' (back slash are removed)

    If the command written in the stack file is { "Fn::Join" : ["", [ "curl -k --request POST --header 'PRIVATE-TOKEN: D77KrrH6YqkOzTTFr7Wq-' "," -F 'title=name' ", "-F 'key=", { "Ref" : "aParam" },"'", " --url ' <one url' "]]} I would like to get in the log the result of Fn::join with the parameter value.

    So I do not think that echo could help me but tell me if I am wrong.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

相关内容