修改

 

/etc/crontab 

 

0 2 * * * root   nohup /路径/junit_soft1.sh >/路径/nohup1.out &

定时两点执行sh脚本,并将结果后台输出到 nohup1.out

 

 junit_soft1.sh内容如下:

 

 

. /etc/profile

export LIB=/路径/lib

export RUN_PATH=/路径/classes

export CLASSPATH=$LIB/引用的包1.jar:$LIB/引用的包2.jar:$RUN_PATH

java org.junit.runner.JUnitCore com.Test1

 

 

红色那行是要注意的地方,在控执台执行时不需要这行,而在crontab中则要加入这行来构建环境,否则会报"java 找不到"

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2021-12-23
  • 2021-06-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-11
  • 2021-06-19
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案