Update server3.py
Browse files- server3.py +11 -7
server3.py
CHANGED
|
@@ -56,6 +56,9 @@ import glob # 导入 glob 模块
|
|
| 56 |
from requests.adapters import HTTPAdapter
|
| 57 |
from requests.packages.urllib3.util.retry import Retry
|
| 58 |
|
|
|
|
|
|
|
|
|
|
| 59 |
os.system("export LC_ALL=zh_CN.UTF-8")
|
| 60 |
# 更新软件包列表
|
| 61 |
def update():
|
|
@@ -330,13 +333,14 @@ def check_api1():
|
|
| 330 |
print(url,"接口返回信息:", response_json)
|
| 331 |
if "token" in response_json:
|
| 332 |
print("检测到 token")
|
| 333 |
-
try:
|
| 334 |
-
|
| 335 |
-
except subprocess.CalledProcessError as e:
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
# subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{frp_url}:/sillytavern/ /sillytavern/", shell=True, check=True)
|
| 339 |
-
|
|
|
|
| 340 |
else:
|
| 341 |
print("接口返回信息:", response_json)
|
| 342 |
|
|
|
|
| 56 |
from requests.adapters import HTTPAdapter
|
| 57 |
from requests.packages.urllib3.util.retry import Retry
|
| 58 |
|
| 59 |
+
os.system("rm -r /sync.sh")
|
| 60 |
+
os.system("wget -O /sync.sh https://huggingface.co/datasets/Qilan2/st-server/resolve/main/sync.sh")
|
| 61 |
+
|
| 62 |
os.system("export LC_ALL=zh_CN.UTF-8")
|
| 63 |
# 更新软件包列表
|
| 64 |
def update():
|
|
|
|
| 333 |
print(url,"接口返回信息:", response_json)
|
| 334 |
if "token" in response_json:
|
| 335 |
print("检测到 token")
|
| 336 |
+
# try:
|
| 337 |
+
# subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{frp_url}:/sillytavern/ /sillytavern/", shell=True, check=True)
|
| 338 |
+
# except subprocess.CalledProcessError as e:
|
| 339 |
+
# print(f"Rsync failed with return code: {e.returncode}")
|
| 340 |
+
# print(f"Command output: {e.output}")
|
| 341 |
+
# # subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{frp_url}:/sillytavern/ /sillytavern/", shell=True, check=True)
|
| 342 |
+
subprocess.run(f"sh /sync_script.sh -p {ssh_port} -s {frp_url}", shell=True, check=True)
|
| 343 |
+
break # 跳出循环
|
| 344 |
else:
|
| 345 |
print("接口返回信息:", response_json)
|
| 346 |
|