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

gefragt vor einem Jahr493 Aufrufe
1 Antwort
0

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

profile picture
EXPERTE
beantwortet vor einem Jahr
  • 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.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen