歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Linux crontab定時java程序

1.定時jar程序

a.腳本

run.sh

#!/bin/sh

if [ `ps -ef |grep cn.com.flaginfo.Main |grep $1 |grep -v grep |wc -l` == 0 ]; then

(cd `dirname $0`;

for jar in ./lib/*.jar; do

classpath="$classpath:$jar"

done

classpath="$classpath:./bin"

CLASSPATH="$classpath"

export CLASSPATH

/opt/java/bin/java cn.com.flaginfo.Main $* )

else

echo "coupon update operation is running"

fi

b.結構

--bin

--llb

--run.sh

3.定時腳本

*/1 * * * * sh /opt/yxt/web/jiangxi_yingtan/run.sh SmsSendCron > /dev/null 2>&1

Copyright © Linux教程網 All Rights Reserved