Qilan2 commited on
Commit
7e3f559
·
verified ·
1 Parent(s): 89c260a

Update server2.py

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