当jar里面抛出错误时如何停止执行shell代码?

时间:2015-01-23 08:58:48

标签: shell

我有一个通过shell脚本运行的jar。但是如果jar抛出一些错误(在这种情况下我们应该更新jar),shell脚本只是继续处理下一行,并且错误在日志中丢失。

当jar抛出错误时,我可以停止执行shell脚本吗?

cd correctDirectory
....../bin/java -cp myjar.jar package.mainclass
#The below should not execute when the above jar throws an error.
Number=$(wc -l outputOfJar.txt)
#insert the above number in DB which if is less than a threshold generates me an alert
#But this is not so effective.

0 个答案:

没有答案