启动项目
#!/bin/bash
array_jar=("user-0.0.1-SNAPSHOT.jar" "register-0.0.1-SNAPSHOT.jar")
for var in ${array_jar[@]};
do
pid=`ps -ef | grep $var | grep -v 'grep' | awk '{print $2}'`
if test -z "$pid";then
`nohup java -jar -Xmx256M -Xms256M $var --spring.profiles.active=qds >$var.log 2>&1 &`
echo "$var 项目启动成功!"
else
echo "$var 项目已启动!"
fi
done
暂停项目
#!/bin/bash
array_jar=("user-0.0.1-SNAPSHOT.jar" "register-0.0.1-SNAPSHOT.jar")
for var in ${array_jar[@]};
do
pid=`ps -ef | grep $var | grep -v 'grep' | awk '{print $2}'`
if test -z "$pid";then
echo "$var 项目未启动!"
else
kill -9 $pid
echo "$var 项目进程$pid关闭成功!"
fi
done