简体   繁体   English

由于怀疑存在权限问题,Ant任务挂起

[英]Ant task hangs due to suspected permissions issue

I have a STAF job which kicks off an Ant script, all run under a functional ID. 我有一份STAF作业,该作业启动了一个Ant脚本,所有脚本均在功能ID下运行。 The ant script does basic 'init' tasks which work fine, and then hangs on one of the following tasks: delete, mkdir, or junit, depending on how much muddling I do in the file system. ant脚本执行基本的“初始化”任务,这些任务可以正常工作,然后挂起以下任务之一:delete,mkdir或junit,具体取决于我在文件系统中所做的工作。

<target name="run.nightly.tests" depends="init">
    <delete dir="/path/results/latestDate" />
    <mkdir dir="/path/results/latestDate"  />
    <chmod perm="777" dir="/path/results/latestDate" />
    <junit printsummary="on" fork="no">
                <!-- typical classpath/tests setup snipped -->
    </junit>
</target>

I am able to sudo to this functional ID and run the corresponding commands from a shell just fine (ex: rm -rf /path/results/latestDate). 我能够使用此功能ID并从外壳程序运行相应的命令就好了(例如:rm -rf / path / results / latestDate)。 Clearly something is different about running in the Ant environment, under the functional id. 显然,在功能ID下在Ant环境中运行的方式有所不同。 (In fact, I can run the script just fine with my own id) (实际上,我可以使用自己的ID运行脚本)

/path/results has 777 permissions before my script runs, and when /path/results/latestDate exists it is owned by the same functional id w/ 777 permissions. / path / results在我的脚本运行之前具有777权限,当/ path / results / latestDate存在时,它由具有777权限的相同功能ID所拥有。

STAF launches this script: STAF启动此脚本:

export ANT_HOME=/opt/apache-ant-1.8.2
#This entire directory tree and jar files are world r+x
LIB_DIR=/home/afreed/automation/dependencies/mail
ant -debug -verbose -buildfile nightlyTest.xml -lib ${LIB_DIR}/mail.jar:${LIB_DIR}/activation.jar

I would understand if Ant would fail on any of these tasks with a permissions error but I cannot understand why it would hang. 我会理解Ant是否会因为权限错误而无法在任何这些任务上失败,但我无法理解为什么它会挂起。

I would like help either a) determining why there is a hang or b) how to convert the hang to a hard failure 我想要帮助a)确定为什么存在挂起或b)如何将挂起转换为硬故障

Solved, the Ant script was hanging on an exec command that was waiting for input from STDIN. 解决后,Ant脚本挂在了一个正在等待STDIN输入的exec命令上。 (Execution had continued past that point because it was launched with 'spawn' attribute.) When I removed this 'exec' task from my 'init' target, the Ant script ran as expected. (执行已经超过了这一点,因为它是使用'spawn'属性启动的。)当我从'init'目标中删除了该'exec'任务时,Ant脚本按预期运行了。

<!-- hanging task in init-->
<exec executable="blah.sh" spawn="true">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM