++++++++++++++++++++++++++++++++++++
PIDS=`ps -ef|grep "app.js"|grep -v grep`
if [ "$PIDS" != "" ]; then
pm2 restart app
echo "app restart!"
else
pm2 start app.js
echo "app started"
fi
+++++++++++++++++++++++++++++++++++
## 下面是node環境 webhook腳本配置
#!/bin/bash
export NODE_HOME=/usr/bin/node
export PATH=$NODE_HOME/bin:$PATH
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
cd /www/wwwroot/api/nodeApi/
git reset --hard origin/master
git clean -f
git pull
PIDS=`ps -ef|grep "app.js"|grep -v grep`
if [ "$PIDS" != "" ]; then
pm2 restart app
echo "app restart!"
else
pm2 start app.js
echo "app started"
fi
pm2 show 0
echo "----------------------------------------------------------------------------"