#/bin/bash

cd /src/pid01-beta/

echo "update pid01.."

git pull

if [ $? -ne  ]; then
echo "update pid01(clientErrorCode.json) from git failed"
exit
fi res=`git pull|grep -c "up-to-date"` if [ $res -eq ]; then
echo "pid01 already latest,quit update"
exit
fi go build if [ $? -ne ]; then
echo "go build failed"
exit
fi rm -rf /data/wesite/pid01-beta if [ $? -ne ]; then
echo "delete old pid01 file failed"
exit
fi mv /src/pid01-beta/pid01-beta /data/website/ if [ $? -ne ]; then
echo "move new pid01 file failed"
exit
fi pidno=`ps aux|grep pid01|grep -v "grep"|awk '{print $2}'` kill - $pidno if [ $? -ne ]; then
echo "old pid01 kill failed"
exit
fi sleep pid01pid=`ps aux|grep pid01|grep -v "grep"|awk '{print $2}'` if [ "$pid01pid" ];then
echo "new version pid01 is running now" fi
04-14 05:07