【问题标题】:Condor job - running shell script as executableCondor 作业 - 将 shell 脚本作为可执行文件运行
【发布时间】:2016-06-07 23:16:43
【问题描述】:

我正在尝试运行 Condor 作业,其中可执行文件是调用某些 Java 类的 shell 脚本。

Universe = vanilla
Executable = /script/testingNew.sh
requirements = (OpSys == "LINUX")
Output =  /locfiles/myfile.out
Log = /locfiles/myfile.log
Error = /locfiles/myfile.err
when_to_transfer_output = ON_EXIT
Notification = Error
Queue

这是 /script/testingNew.sh 文件的内容 – (只是因为我遇到了错误,我现在已经删除了 Java 命令)

#!/bin/sh
inputfolder=/n/test_avp/test-modules/data/json
srcFolder=/n/test_avp/test-modules
logsFolder=/n/test_avp/test-modules/log
libFolder=/n/test_avp/test-modules/lib
confFolder=/n/test_avp/test-modules/conf
twpath=/n/test_avp/test-modules/normsrc
dataFolder=/n/test_avp/test-modules/data
scriptFolder=/n/test_avp/test-modules/script
locFolder=/n/test_avp/test-modules/locfiles
bakUpFldr=/n/test_avp/test-modules/backupCurrent

cd $inputfolder
filename=`date -u +"%Y%m%d%H%M"`.txt
echo  $filename  $(date -u)

mkdir $bakUpFldr/`date -u +"%Y%m%d"`

dirname=`date -u +"%Y%m%d"`
flnme=current_json_`date -u +"%Y%m%d%H%M%S"`.txt
echo DIRNameis $dirname Filenameis $flnme

cp $dataFolder/current_json.txt  $bakUpFldr/`date -u +"%Y%m%d"`/current_json_$filename
cp $dataFolder/current_json.txt   $filename

mkdir $inputfolder/`date -u +"%Y%m%d"`
echo Creating Directory  $(date -u)

mv $filename $filename.inprocess
echo Created Inprocess file  $(date -u)

另外,这是 Condor 的错误日志 -

000 (424639.000.000) 09/09 16:08:18 Job submitted from host: <135.207.178.237:9582>
...
001 (424639.000.000) 09/09 16:08:35 Job executing on host: <135.207.179.68:9314>
...
007 (424639.000.000) 09/09 16:08:35 Shadow exception!
    Error from slot1@marcus-8: Failed to execute '/n/test_avp/test-modules/script/testingNew.sh': (errno=8: 'Exec format error')
    0  -  Run Bytes Sent By Job
    0  -  Run Bytes Received By Job
...
012 (424639.000.000) 09/09 16:08:35 Job was held.
    Error from slot1@marcus-8: Failed to execute '/n/test_avp/test-modules/script/testingNew.sh': (errno=8: 'Exec format error')
    Code 6 Subcode 8
...

谁能解释导致这个错误的原因,以及如何解决这个问题? testingNew.sh 脚本在 Linux 机器上运行良好,如果在网络机器上单独执行。 多谢!! - GR

【问题讨论】:

  • 能把stdout的内容也发给condor吗?
  • 您是否 100% 确定您的 shell 脚本中的第一行是 #!/bin/sh,并且它上面没有空行(或注释)?脚本的文件权限是否不仅允许所有者,还允许任何用户执行它?

标签: linux shell condor


【解决方案1】:

在我们的例子中,原因是 shell 脚本使用 DOS 行尾而不是 Unix 行尾。

Linux 内核很乐意尝试将脚本提供给/bin/sh(如您所愿),而不是/bin/sh 。 (你看到后面的回车符了吗?我也没有,但 Linux 内核看到了。)那个文件不存在,所以,作为最后的手段,它会尝试将脚本作为二进制可执行文件执行,但失败了有给定的错误。

【讨论】:

    【解决方案2】:

    您需要将输入指定为:

    input   = /dev/null
    

    来源:Submitting a job to Condor

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-24
      • 1970-01-01
      • 2016-03-19
      • 2013-03-16
      • 1970-01-01
      • 1970-01-01
      • 2012-04-05
      • 2014-09-06
      相关资源
      最近更新 更多