一、停止

(1)直接停止

#!/bin/bash
  echo "Stopping fsn Application"
  kill -9 $(ps -ef|grep fsn-iot|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')

(2)参数形式

#!/bin/bash
  echo "Stopping tlyazd"
  pid=`ps -ef | grep fsn-base-s-1.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
  if [ -n "$pid" ]
  then
  kill -9 $pid
  fi

二、启动

 

#!/bin/bash
  echo "执行....."
  nohup java -Xms256M -Xmx512M -Djava.security.egd=file:/dev/./urandom -Djava.io.tmpdir=/home/antaiib/core-iot-data/yczhyq/temp -Dloader.path=/home/antaiib/core-iot-data/yczhyq/libs -jar /home/antaiib/core-iot-data/yczhyq/fsn-iot-datareport-1.0-SNAPSHOT.jar --spring.profiles.active=client --mqtt.domain=yczhyq --server.port=38090 > /home/antaiib/core-iot-data/yczhyq/logs/core-iot-data.log 2>&1 &