pull/267/head
midoks 3 years ago
parent ece7d43950
commit 6d8e5403c8
  1. 1
      class/core/cert_request.py
  2. 30
      scripts/init.d/mw.tpl

@ -284,6 +284,7 @@ class cert_request:
headers = {"User-Agent": self.__user_agent} headers = {"User-Agent": self.__user_agent}
response = requests.get(self.__apis[ response = requests.get(self.__apis[
'newNonce'], timeout=self.__acme_timeout, headers=headers, verify=self.__verify) 'newNonce'], timeout=self.__acme_timeout, headers=headers, verify=self.__verify)
self.__replay_nonce = response.headers["replay-nonce"] self.__replay_nonce = response.headers["replay-nonce"]
except Exception as e: except Exception as e:
raise Exception("获取随机数失败: {}".format(str(e))) raise Exception("获取随机数失败: {}".format(str(e)))

@ -22,15 +22,13 @@ PATH=$PATH:$mw_path/bin
if [ -f $mw_path/bin/activate ];then if [ -f $mw_path/bin/activate ];then
source $mw_path/bin/activate source $mw_path/bin/activate
else
echo ""
fi fi
mw_start_panel() mw_start_panel()
{ {
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "Starting mw-panel... \c" echo -e "starting mw-panel... \c"
cd $mw_path && gunicorn -c setting.py app:app cd $mw_path && gunicorn -c setting.py app:app
port=$(cat ${mw_path}/data/port.pl) port=$(cat ${mw_path}/data/port.pl)
isStart="" isStart=""
@ -45,12 +43,12 @@ mw_start_panel()
fi fi
done done
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m" echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------' echo '------------------------------------------------------'
tail -n 20 ${mw_path}/logs/error.log tail -n 20 ${mw_path}/logs/error.log
echo '------------------------------------------------------' echo '------------------------------------------------------'
echo -e "\033[31mError: mw-panel service startup failed.\033[0m" echo -e "\033[31mError: mw-panel service startup failed.\033[0m"
return; return;
fi fi
echo -e "\033[32mdone\033[0m" echo -e "\033[32mdone\033[0m"
else else
@ -68,12 +66,12 @@ mw_start_task()
sleep 0.3 sleep 0.3
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}') isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m" echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------' echo '------------------------------------------------------'
tail -n 20 $mw_path/logs/task.log tail -n 20 $mw_path/logs/task.log
echo '------------------------------------------------------' echo '------------------------------------------------------'
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m" echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
return; return;
fi fi
echo -e "\033[32mdone\033[0m" echo -e "\033[32mdone\033[0m"
else else
@ -111,7 +109,7 @@ mw_stop_panel()
arr=`ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}'` arr=`ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}'`
for p in ${arr[@]} for p in ${arr[@]}
do do
kill -9 $p &>/dev/null kill -9 $p &>/dev/null
done done
pidfile=${mw_path}/logs/mw.pid pidfile=${mw_path}/logs/mw.pid

Loading…
Cancel
Save