From 0d8ae9edaf87b875686589515ea33a0a8f4bb44b Mon Sep 17 00:00:00 2001 From: F2DRD <53929319+newkld@users.noreply.github.com> Date: Fri, 16 Jul 2021 22:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20install.sh=20and=20Redu?= =?UTF-8?q?ce=20update=20notification=20frequency.=20(#106)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 更新一键脚本。 * 📝 减少更新通知频率为 1次每天。 Co-authored-by: Xtao_dada --- install.sh | 12 ++++++++---- pagermaid/modules/update.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index a6a5738..9e56766 100644 --- a/install.sh +++ b/install.sh @@ -74,6 +74,7 @@ yum_python_check() { echo "Python3.6 未安装在此系统上,正在进行安装" yum install python3 -y >>/dev/null 2>&1 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1 + PYV=$(which python3.6) fi if command -v pip3 >>/dev/null 2>&1; then echo 'pip 存在 . . .' @@ -150,6 +151,7 @@ apt_python_check() { apt-get update >>/dev/null 2>&1 apt-get install python3.6 -y >>/dev/null 2>&1 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1 + PYV=$(which python3.6) fi if command -v pip3 >>/dev/null 2>&1; then echo 'pip 存在 . . .' @@ -186,8 +188,8 @@ debian_python_check() { make && make install >>/dev/null 2>&1 cd .. >>/dev/null 2>&1 rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1 - PYP=$(which python3.6) - update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1 + PYV=$(which python3.6) + update-alternatives --install /usr/bin/python3 python3 $PYV 1 >>/dev/null 2>&1 fi fi else @@ -202,8 +204,8 @@ debian_python_check() { make && make install >>/dev/null 2>&1 cd .. >>/dev/null 2>&1 rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1 - PYP=$(which python3) - update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1 + PYV=$(which python3) + update-alternatives --install /usr/bin/python3 python3 $PYV 1 >>/dev/null 2>&1 fi echo "正在检查 pip3 安装情况 . . ." if command -v pip3 >>/dev/null 2>&1; then @@ -356,6 +358,8 @@ login_screen() { screen -x -S userbot -p 0 -X stuff "$phonenum" screen -x -S userbot -p 0 -X stuff $'\n' + sleep 2 + if [ "$(ps -def | grep [p]agermaid | grep -v grep)" == "" ]; then echo "手机号输入错误!请确认您是否带了区号(中国号码为 +86 如 +8618888888888)" screen -x -S userbot -p 0 -X stuff "cd /var/lib/pagermaid && $PYV -m pagermaid" diff --git a/pagermaid/modules/update.py b/pagermaid/modules/update.py index 2e60b0e..fb09a7b 100644 --- a/pagermaid/modules/update.py +++ b/pagermaid/modules/update.py @@ -47,7 +47,7 @@ async def update_refresher(context): need_update_check = True if not need_update_check: return - if time.time() - update_get_time > 3600: + if time.time() - update_get_time > 86400: update_get_time = time.time() changelog = None try: