美文网首页
shell脚本-批量杀死进程并重启

shell脚本-批量杀死进程并重启

作者: lancelot123 | 来源:发表于2021-02-02 11:48 被阅读0次
    RESOURCE_NAME=ktwjs-socket.jar
    stop(){
      #kill 掉所有java程序
      PROCESS=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
      for pid in $PROCESS
      do
           echo "kill the $RESOURCE_NAME process [ $pid ]"
           kill -9  $pid
      done
    }
    stop
    #ps -ef|grep $RESOURCE_NAME | grep -v grep | awk '{print $2}' | xargs kill -9
    nohup java -Xverify:none -XX:+HeapDumpOnOutOfMemoryError -Dtio.default.read.buffer.size=512 -XX:HeapDumpPath=/logs/java-t-io-ktqyc-server-pid.hprof -cp /home/q/kt-server-deploy/socket-server/$RESOURCE_NAME org.tio.ktqyc.socket.server.WjsServerStarter prod &
    
    #tail -f ./nohup.out 
    

    相关文章

      网友评论

          本文标题:shell脚本-批量杀死进程并重启

          本文链接:https://www.haomeiwen.com/subject/olfytltx.html