linux启动java程序脚本

FLAG=`jps | grep  TransferBalanceSameBookMain | grep -v 'grep' | wc -l`
if [ $FLAG != 0 ]; then
echo "TransferBalanceSameBookMain  has started, rerun after kill !!!"
exit
fi

LIB_DIR=/export/home/billing/App/lib
LIB_JARS=`ls $LIB_DIR|grep .jar|grep -v saf-1.0.9.jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
CONF_DIR=/export/home/billing/App/resources/interface
nohup java -server -Xms1g -Xmx1g -XX:PermSize=128m -classpath $CONF_DIR:$LIB_JARS -Djava.security.egd=file:///dev/urandom -DLOG.DIR=/export/home/billing/Logs/interface -DLOG.NAME=transferbalancesamebook com.tydic.beijing.billing.interfacex.TransferBalanceSameBookMain > /dev/null &

这里是引用

PROCESS_num=5

FLAG=`ps -ef | grep AccountProcessMain | grep -v 'grep' | wc -l`
if [ $FLAG != 0 ]; then
        echo "AccountProcessMain has started, rerun after kill !!!"
        exit
fi

CONF_DIR=/export/home/billing/App/resources_account/account
LIB_DIR=/export/home/billing/App/lib_account
LIB_JARS=`ls $LIB_DIR|grep .jar$|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
LOG_DIR=$account_log_path

for((ID=0; ID<$PROCESS_num; ID++));
do
echo AccountProcessMain$ID is starting!!!!!

#echo -DCREDIT.CHANNELNO=$ID
nohup java -server -Xms2g -Xmx2g -XX:PermSize=128m -classpath $CONF_DIR:$LIB_JARS -Djava.security.egd=file:///dev/urandom -DCREDIT.CHA
NNELNO=$ID -DLOG.DIR=$LOG_DIR -DLOG.NAME=accoutProcess_$ID com.tydic.beijing.billing.account.AccountProcessMain >/dev/null &
sleep 8

echo AccountProcessMain$ID has started!!!!!!!!
done

你可能感兴趣的:(linux)