2007-2-14
郁闷了我好几天
在linux中定时启动java应用。
sh脚本:[ftc=#C6DF9C]
PATH=$PATH:.:/backup/j2sdk1.4.2_10/bin
export PATH
echo path=$PATH[/ft]
JARPATH=/home/mms/WEB-INF/lib
export JARPATH
echo jarpath=$JARPATH
export CLASSPATH=$CLASSPATH:$JARPATH/mms_statistic.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-logging-1.0.2.jar
export CLASSPATH=$CLASSPATH:$JARPATH/ant-1.5.jar
export CLASSPATH=$CLASSPATH:$JARPATH/cbd-common.jar
export CLASSPATH=$CLASSPATH:$JARPATH/cbd-db.jar
export CLASSPATH=$CLASSPATH:$JARPATH/classes12.jar
export CLASSPATH=$CLASSPATH:$JARPATH/log4j-1.2.6.jar
export CLASSPATH=$CLASSPATH:$JARPATH/torque-3.0.2.jar
export CLASSPATH=$CLASSPATH:$JARPATH/village-1.5.3.jar
export CLASSPATH=$CLASSPATH:$JARPATH/village-2.0-dev-20021111.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-lang-1.0.1.jar
export CLASSPATH=$CLASSPATH:$JARPATH/stratum-1.0-b3.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-configuration-1.0-dev.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-beanutils.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-dbcp-1.0-dev-20020806.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-pool-1.0.1.jar
export CLASSPATH=$CLASSPATH:$JARPATH/commons-collections-2.0.jar
export CLASSPATH=$CLASSPATH:$JARPATH/dom4j-1.6.1.jar
export CLASSPATH=$CLASSPATH:$JARPATH/jaxen-1.1-beta-6.jar
[ftc=#C6DF9C]echo classpath=$CLASSPATH
cd /home/mms/WEB-INF/classes[/ft]
java -Xms256m -Xmx256m -cp .:$CLASSPATH com.mcsky.mms.statistic.manager.StatisticManager >> stat.log &
这个path一定要指定完全,还有最厚在执行的时候将目录cd到应用程序目录
crontal:
00 03 * * * /sh的路径(每天3点启动)