2 Star 1 Fork 0

bingxing_project/OmcServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
run.sh 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
wang 提交于 2021-06-24 11:58 . first add
#!/bin/bash
#set -x
source /etc/profile
function get_pid(){
echo `ps aux|grep "${UWSGI} --uid "|grep ":${port} "|grep -v "grep"|awk '{print $2}' |xargs`
}
function Status(){
pid=`get_pid`
if [ "X$pid" != "X" ];then
echo "uwsgi-${app} is running![$pid]"
else
echo "uwsgi-${app} is not running!"
fi
}
function Start(){
pid=`get_pid`
if [ "X$pid" != "X" ];then
echo "uwsgi-${app} is running![$pid]"
return
else
${UWSGI} --uid ${USER} -s ${host}:${port} --gevent 1000 -M -t 30 --pidfile ${pidfile} --chdir ${cur_dir} -w myapp:flask_app -d ${logfile} --logformat "${UWSGI_LOG_FORMAT}"
fi
sleep 1
pid=`get_pid`
if [ "X$pid" = "X" ];then
echo "Start uwsgi-${app} failed"
exit 1
else
echo "Start uwsgi-${app} success![$pid]"
fi
}
function Stop(){
pid=`get_pid`
if [ "X$pid" = "X" ];then
echo "uwsgi-${app} is not running!"
else
${UWSGI} --uid ${USER} --stop ${pidfile}
if [ $? -ne 0 ];then
echo "Stop uwsgi-${app} failed![$pid]"
exit 1
else
echo "Stop uwsgi-${app} success!"
fi
fi
}
function Reload(){
pid=`get_pid`
if [ "X$pid" = "X" ];then
echo "uwsgi-${app} is not running!"
Start
else
${UWSGI} --uid ${USER} --reload ${pidfile}
if [ $? -ne 0 ];then
echo "Reload uwsgi-${app} failed![$pid]"
exit 1
else
pid=`get_pid`
if [ "X$pid" != "X" ];then
echo "Reload uwsgi-${app} success![$pid]"
else
echo "Reload uwsgi-${app} failed!"
exit 1
fi
fi
fi
}
cur_dir="$(cd `dirname "$0"` && pwd)"
#UWSGI='/data/apps/py36_flask/bin/uwsgi'
UWSGI='/home/wyp/.local/bin/uwsgi'
UWSGI_LOG_FORMAT='"%(ltime)" "%(addr)" "%(uagent)" "%(method) %(uri)" %(cl)B %(status) %(rsize)B %(msecs)ms'
USER='uwsgi'
app='web'
host='127.0.0.1'
port='8890'
pidfile="/var/run/uwsgi-${app}.pid"
logfile="/var/log/uwsgi-${app}.log"
if [ "${1,,}" = "status" ]; then
Status
elif [ "${1,,}" = "start" ]; then
Start
elif [ "${1,,}" = "stop" ];then
Stop
elif [ "${1,,}" = "reload" ];then
Reload
elif [ "${1,,}" = "restart" ];then
Stop && sleep 1 && Start
else
echo -e "Usages:\n\tbash $0 [status|start|stop|reload|restart]"
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/pingtan_web/omc-server.git
[email protected]:pingtan_web/omc-server.git
pingtan_web
omc-server
OmcServer
master

搜索帮助