gpt4 book ai didi

linux - Condor 作业 - 将 shell 脚本作为可执行文件运行

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:42:00 25 4
gpt4 key购买 nike

我正在尝试运行一个 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

最佳答案

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

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

关于linux - Condor 作业 - 将 shell 脚本作为可执行文件运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18706406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com