shell script load jar files and hang

。_饼干妹妹 提交于 2019-12-11 16:59:57

问题


Good day,

I have a shell script, which will load some jar files first before proceed to do its job. The following is part of my shell script code to load jar files:

for f in `find $BASEDIR/lib -type f -name "*.jar"` 
do 
  CLASSPATH=$CLASSPATH:$f
  echo Getting  jar file : $f... >> $LOG
done

This is working fine when I trigger this through Crontab, I set a time in crontab and let it trigger automatically, and its work without any error.

However, I having some problem when I trigger this shell script through application run time. Here is my java code to trigger this shell script:

try {
  p = Runtime.getRuntime().exec("myShell.sh");
  log.debug("Successfully invoked batch.");
} catch (Exception ex) {

  log.info("Hit error : "
      + ex.getMessage());

  return false;
}

I checked the log that I put in the shell script, and found that its hang when trying to getting "xstream-1.4.9.jar" (during run time call). But crontab call have no issue.

And another weird thing is, I have 2 same environment, which is environment 1 and environment 2, and this issue only happen in environment 2, checked through all the permission, they are the same.

Can anyone advise how I can continue to troubleshoot on this?

来源:https://stackoverflow.com/questions/54664662/shell-script-load-jar-files-and-hang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!