active=$1
if [[ -z "$active" ]]; then
echo -e "\033[31m=====> active不能为空并只能是 dev | test | prod \033[0m"
exit 1
fi
rm -rf nohup.log
cd manage-back
git pull
mvn clean package -P${active} -Dmaven.test.skip=true
case $? in 0)
echo -e "\033[32m\n[INFO] =========================> 成功 <=========================\n\033[0m"
;;
*)
echo -e "\033[31m\n[ERROR] =========================> 失败 <=========================\n\033[0m"
exit 1;
;;
esac
pid=`ps -ef|grep manage-back-*|grep -v grep|awk '{print $2}'`
kill -9 ${pid}
nohup java -jar -Xms256m -Xmx360m target/manage-back-*.jar > nohup.log 2>&1 &
sleep 3
tail -f nohup.log