###
# @Descripttion:
# @version:
# @Author: Neo,Huang
# @Date: 2020-11-06 09:53:23
 # @LastEditors: Neo,Huang
 # @LastEditTime: 2023-11-18 22:15:29
###
#!/bin/bash

if [ $1 == "" ]; then
    echo "请加上环境参数"
    exit 1
fi

proName="gm-"$1

go build -o $proName

echo "kill $proName, copy new file"
# kill -9 `cat ./$proName.pid`
ps -ef|grep $proName |grep -v grep |awk '{print $2}' | xargs kill -9
# kill -9 `ps -ef|grep $proName`
# echo $pid
# kill -9 $pid
sleep 0.5

cp conf/$1/app.conf_ali_test ./conf/app.conf

rm -rf ./nohup_$1.out

echo "restart "$proName

nohup ./$proName $2 > nohup_$1.log 2>&1 &

echo "ok"
exit 0;