代码拉取完成,页面将自动刷新
同步操作将从 陈乾/TLv8-Flask-layui 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/sh
export FLASK_PATH=/app/flask/tlv8-python-flask
export FLASK_PID=$FLASK_PATH/flask.pid
#export FLASK_PROJECT=$FLASK_PATH/tlv8-python-flask
echo $FLASK_PATH
if [ "$1" = "start" ]; then
if [ ! -z "$FLASK_PID" ]; then
if [ -f "$FLASK_PID" ]; then
if [ -s "$FLASK_PID" ]; then
echo "Existing PID file found during start."
if [ -r "$FLASK_PID" ]; then
PID=$(cat "$FLASK_PID")
ps -p $PID >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Flask appears to still be running with PID $PID. Start aborted."
echo "If the following process is not a Flask process, remove the PID file and try again:"
ps -f -p $PID
exit 1
else
echo "Removing/clearing stale PID file."
rm -f "$FLASK_PID" >/dev/null 2>&1
if [ $? != 0 ]; then
if [ -w "$FLASK_PID" ]; then
cat /dev/null >"$FLASK_PID"
else
echo "Unable to remove or clear stale PID file. Start aborted."
exit 1
fi
fi
fi
else
echo "Unable to read PID file. Start aborted."
exit 1
fi
else
rm -f "$FLASK_PID" >/dev/null 2>&1
if [ $? != 0 ]; then
if [ ! -w "$FLASK_PID" ]; then
echo "Unable to remove or write to empty PID file. Start aborted."
exit 1
fi
fi
fi
fi
fi
echo "To Start Flask"
if [ -z "$FLASK_PROJECT" ]; then
echo "Message: \$FLASK_PROJECT not set"
else
cd $FLASK_PROJECT
pwd
fi
source venv/bin/activate
echo "Load flask venv"
mkdir -p $FLASK_PATH/logs >/dev/null 2>&1
echo "Log folder created"
nohup python server.py >$FLASK_PATH/logs/flask.log 2>&1 &
echo "start in nohup"
echo $! >$FLASK_PID
echo "PID:$(cat $FLASK_PID)"
echo "Flask started."
elif [ "$1" = "stop" ]; then
if [ ! -z "$FLASK_PID" ]; then
if [ -f "$FLASK_PID" ]; then
if [ -s "$FLASK_PID" ]; then
kill -0 $(cat "$FLASK_PID") >/dev/null 2>&1
if [ $? -gt 0 ]; then
echo "PID file found but either no matching process was found or the current user does not have permission to stop the process. Stop aborted."
exit 1
fi
else
echo "PID file is empty and has been ignored."
fi
else
echo "\$FLASK_PID was set but the specified file does not exist. Is Flask running? Stop aborted."
exit 1
fi
fi
echo "To Stop Flask"
kill -9 $(cat $FLASK_PID) >/dev/null 2>&1
echo "Flask stopped."
rm -f $FLASK_PID >/dev/null 2>&1
echo "PID File cleared."
else
echo "Action Type No Support."
exit 1
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。