2 hzwowo hzwowo 于 2014.03.31 21:29 提问

crontab 执行 jar 问题

这是crontab 设置

1 0 * * * /home/seal/restartKillTomcat.sh
*/3 * * * * /home/seal/guarder/guarder.sh
5 0 * * * /home/seal/payment.sh
*/1 * * * * /home/seal/ws_V0.0.2/restart.sh

这个是restart.sh

pid=`ps aux | grep mwsjar.jar|grep -v grep |grep -v cronolog| awk '{print $2}'`

echo $pid
echo ===========shutdown================

for p in $pid; do
sleep 1
echo ========kill tomcat begin==============
echo $p
kill -9 $p
echo ========kill tomcat end==============
done

sleep 1
echo 'AFAFA' > /home/seal/ws_V0.0.2/logs/hello.log
export JAVA_HOME=/usr/java/jdk1.6.0_31
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
nohup java -jar mwsjar.jar production &
echo 'over' > /home/seal/ws_V0.0.2/logs/hello.log

然后hello.log每份钟都在更新,表名已经在执行这个restart.sh文件了,但是jar就是起不来 麻烦各会大神给我看下

1个回答

oyljerry
oyljerry   Ds   Rxr 2015.01.11 20:38

java命令加到路径了没

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!