2012-04-14 33 views
2

我正嘗試在ubuntu 11.10 ec2實例上啓動一個帶有cloud-init的腳本。ubuntu ec2-instance cloud-init per-boot腳本

我把腳本script.sh放在文件夾/var/lib/cloud/scripts/per-boot。的script.sh
內容很簡單:

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']

任何想法如何解決它:

#/!/bin/sh 
echo "test"

重新啓動,我收到以下錯誤後?

回答

4

我相信你的問題與#/!/bin/sh不是有效的輸入類型有關。需要刪除#後的#。

#!/bin/sh 
echo "test" 

讓我知道你是否仍然在這之後看到問題。

+0

謝謝,那是這些典型的簡單而愚蠢的錯誤之一:D – jubi4dition 2012-04-15 16:07:35