批量处理linux java -jar jar服务模块脚本

#!/bin/sh

#comments batch run po server 


config_nohup='nohup java -jar ';

config_command='command 1>'; 

config_and='86400 & ';

 

alert_1='一键启动PO-SERVER基础服务设施';


function configServer(){ #加载批量基础服务

  cd /;

  cd home/witts-java/Desktop/package/192.168.0.124/;

  ${config_nohup} guadan2.0-9304.jar command 1>guadan2.0.output 2>guadan.error 86400 &

  if [ $? -eq 0 ]; then

    echo "挂单模块执行成功";

  else

    echo "挂单模块执行失败";

  fi


  ${config_nohup} order2.0-9311.jar  command 1>order2.0.output 2>order2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "订单模块执行成功";

  else

    echo "订单模块执行失败";

  fi 


  ${config_nohup} project2.0-9302.jar command 1>project2.0.output 2>project2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "项目模块执行成功";

  else

    echo "项目模块执行失败";

  fi


  ${config_nohup} reports2.0-9305.jar command 1>reports2.0.output 2>reports2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "报表模块执行成功";

  else

    echo "报表模块执行失败";

  fi


  ${config_nohup} share2.0-9303.jar command 1>share2.0.output 2>share2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "分享模块执行成功";

  else

    echo "分享模块执行失败";

  fi


  ${config_nohup} shop2.0-9306.jar command 1>shop2.0.output 2>shop2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "店铺模块执行成功";

  else

    echo "店铺模块执行失败";

  fi


  ${config_nohup} spend2.0-9307.jar command 1>spend2.0.output 2>spend2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "开支模块执行成功";

  else

    echo "开支模块执行失败";

  fi


  ${config_nohup} storage2.0-9308.jar command 1>storage2.0.output 2>storage2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "库存模块执行成功";

  else

    echo "库存模块执行失败";

  fi


  ${config_nohup} system2.0-9301.jar command 1>system2.0.output 2>system2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "系统模块执行成功";

  else

    echo "系统模块执行失败";

  fi


  ${config_nohup} table2.0-9312.jar command 1>table2.0.output 2>table2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "台桌模块执行成功";

  else

    echo "台桌模块执行失败";

  fi


  ${config_nohup} ubs2.0-9309.jar command 1>ubs2.0.output 2>ubs2.error 86400 &

  if [ $? -eq 0 ]; then

    echo "师徒系统模块执行成功";

  else

    echo "师徒系统模块执行失败";

  fi

} 




echo $alert_1;


protData=$(ps -x|grep java|grep -v grep|awk '{print $1}');

 

echo "!!!杀死端口参数信息 "$protData"!!!";


kill -s 9 $protData;


###################################################################

if [ $? -eq 0 ]; then

  echo "********************杀死进程成功!开始启动服务********************"; 

  excuteRet1=$(configServer $1); 

  echo $excuteRet1;

  echo "1号调用返回状态"$?;

  if [ $? -eq 0 ]; then

  echo "1号重启服务成功啦";

  fi


else 

  echo "********************杀死进程失败!直接启动服务********************";    

  excuteRet2=$(configServer $1); 

  echo $excuteRet2;

  echo "2号调用返回状态"$?;

  if [ $? -eq 0 ]; then

  echo "2号重启服务成功啦";

  fi	


fi

###################################################################

你可能感兴趣的:(java,linux)