2012-04-14 9 views
2

Ich versuche, ein Skript mit cloud-init auf einer Ubuntu 11.10 ec2-Instanz zu starten.cloud-init Per-Boot-Skript auf ubuntu ec2-instance

Ich legte das Skript script.sh in den Ordner /var/lib/cloud/scripts/per-boot.
Inhalt von script.sh ist einfach:

#/!/bin/sh 
echo "test"

Nach einem Neustart, erhalte ich folgende Fehlermeldung:

run-parts: failed to exec /var/lib/cloud/scripts/per-boot/script.sh: Exec format error 
run-parts: /var/lib/cloud/scripts/per-boot/script.sh exited with return code 1 
2012-04-14 19:10:52,642 - cc_scripts_per_boot.py[WARNING]: failed to run-parts in /var/lib/cloud/scripts/per-boot 
2012-04-14 19:10:52,648 - __init__.py[WARNING]: Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 108, in run_cc_modules 
    cc.handle(name, run_args, freq=freq) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 72, in handle 
    [ name, self.cfg, self.cloud, cloudinit.log, args ]) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/__init__.py", line 309, in sem_and_run 
    func(*args) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/cc_scripts_per_boot.py", line 27, in handle 
    util.runparts(runparts_path) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 140, in runparts 
    raise subprocess.CalledProcessError(sp.returncode,cmd) 
CalledProcessError: Command '['run-parts', '--regex', '.*', '/var/lib/cloud/scripts/per-boot']' returned non-zero exit status 1 

2012-04-14 19:10:52,648 - __init__.py[ERROR]: config handling of scripts-per-boot, None, [] failed 

cloud-init boot finished at Sat, 14 Apr 2012 19:10:52 +0000. Up 3.70 seconds 
2012-04-14 19:10:52,672 - cloud-init-cfg[ERROR]: errors running cloud_config [final]: ['scripts-per-boot'] 
errors running cloud_config [final]: ['scripts-per-boot']

Irgendwelche Ideen, wie es zu beheben?

Antwort

4

Ich glaube, Ihr Problem hängt mit der Tatsache zusammen, dass #/!/bin/sh kein gültiger Eingabetyp ist. Müssen die/nach dem # entfernen.

#!/bin/sh 
echo "test" 

Lassen Sie mich wissen, wenn Sie noch die Probleme danach sehen.

+0

Vielen Dank, das war einer dieser typischen einfachen und dummen Fehler: D – jubi4dition