eggbean | When I add this it results in not being able to connect to the instance. The disk is attached under bootcmd aws mount-disk, so it should be happening before the mount: | 12:30 |
---|---|---|
eggbean | mounts: | 12:30 |
eggbean | - [ sdf, /home, "ext4", "rw,defaults", "0", "2" ] | 12:31 |
eggbean | Terraform also fails to apply tags to the instance because of this for some reason. | 12:31 |
eggbean | What's wrong with my mounts: line? | 12:32 |
eggbean | If I comment it out everything works fine | 12:32 |
eggbean | It worked when I used the partitiion UUID, which is not ideal in this situation. | 16:08 |
bpatel | How do I run the following script with cloud-init. #!/bin/bash | 17:55 |
bpatel | time_to_wait=10 | 17:55 |
bpatel | counter=0 | 17:55 |
bpatel | while [ ! -f /tmp/foo.txt ] | 17:55 |
bpatel | do | 17:55 |
bpatel | sleep 1 | 17:55 |
bpatel | ((counter+=1)) | 17:56 |
bpatel | if [ $counter -gt $time_to_wait ] | 17:56 |
bpatel | then | 17:56 |
bpatel | echo "not found" | 17:56 |
bpatel | exit | 17:56 |
bpatel | fi | 17:56 |
bpatel | done | 17:56 |
bpatel | I would like to run this inline | 17:56 |
bpatel | I have tried using runcmd but have had no success | 17:56 |
minimal | bpatel: what happened with runcmd? did it not run? did the cloud-init.log show an error? | 18:02 |
bpatel | I have tried using the following code runcmd: | 18:03 |
bpatel | - [ #!/bin/bash ] | 18:03 |
bpatel | - [ time_to_wait=10 ] | 18:03 |
bpatel | - [ counter=0 ] | 18:03 |
bpatel | - [ 'while [ ! -f /tmp/foo.txt ]' ] | 18:03 |
bpatel | - [ do ] | 18:03 |
bpatel | - [ sleep 1 ] | 18:03 |
bpatel | - [ ((counter+=1)) ] | 18:03 |
bpatel | - [ 'if [ $counter -gt $time_to_wait ]' ] | 18:03 |
bpatel | - [ then ] | 18:03 |
bpatel | - [ echo "not found" ] | 18:03 |
bpatel | - [ exit ] | 18:03 |
bpatel | - [ fi ] | 18:03 |
bpatel | - [ done ] and when I run | 18:03 |
bpatel | the syntax checker it throws an error | 18:04 |
bpatel | cloud-init devel schema --config-file templates/test_sh.tmpl | 18:04 |
bpatel | Cloud config schema errors: format-l10.c3: File templates/test_sh.tmpl is not valid yaml. while parsing a flow node | 18:04 |
bpatel | expected the node content, but found '-' | 18:04 |
bpatel | in "<byte string>", line 10, column 3: | 18:04 |
bpatel | - [ time_to_wait=10 ] | 18:04 |
bpatel | ^ | 18:04 |
minimal | bpatel: runcmd is for running *commands*, if you want to run a script then first create the script using write_files and then run it using runcmd. | 18:07 |
bpatel | ok,so create a script with the above content and run that with | 18:09 |
bpatel | runcmd | 18:09 |
bpatel | will give it a go. | 18:09 |
bpatel | Thanks minimal | 18:13 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!