【发布时间】:2016-07-20 12:27:05
【问题描述】:
我在 14.04.1-Ubuntu 上运行它
Linux matlabrun 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
使用java版本:
java 版本 "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64 位服务器 VM(构建 24.80-b11,混合模式)
所以我的 cron testrun 和 delme.jar 中有两个元素。
PATH=/usr/bin/java:/usr/bin/javac:/usr/lib/jvm/java-7-oracle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Runtime/v85/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/$
XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Runtime/v85/X11/app-defaults:/usr/local/MATLAB/MATLAB_Runtime/v90/X11/app-defaults
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
5,10,15,20,30,35,40,43,45,50,52,55,58 * * * 0,1,2,3,4,5,6 /home/meh/model/TestModelABC/testrun > /home/meh/model/TestModelABC/testrun.log
5,10,13,15,17,18,20,25,30,33,35,36,40,43,45,50,52,55,58 * * * 0,1,2,3,4,5,6 java -jar /home/meh/model/TestModelABC/delme.jar > /home/meh/model/TestModelABC/del.log
testrun 是一个 bash 脚本,这样调用 java 代码:
#!/bin/sh
java -jar delme.jar
这不起作用。当我从 crontab 中直接通过 java -jar delme.jar 调用文件时,它也不起作用。
我知道 cron 正在运行它只是没有执行 java。
为此,如您所见,我将路径放入 crontab 中,并尝试将路径放入 bash 脚本中,如下所示:
PATH=/usr/bin/java:/usr/bin/javac:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Runtime/v85/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64:
XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Runtime/v85/X11/app-defaults:/usr/local/MATLAB/MATLAB_Runtime/v90/X11/app-defaults
echo "Forecast Test"
我现在真的被困住了,因为我没有东西可以尝试。有任何想法吗?我的直觉告诉我这是一个 PATH 问题,但我不知道还有什么要尝试的。
【问题讨论】:
-
作业向 stderr 写入了什么?
-
testrun应该在哪里找到delme.jar?它应该怎么知道它住在哪里?
标签: java bash cron classpath crontab