Update server2.py
Browse files- server2.py +6 -6
server2.py
CHANGED
|
@@ -92,6 +92,10 @@ from requests.packages.urllib3.util.retry import Retry
|
|
| 92 |
os.system("rm -r /sync.sh")
|
| 93 |
os.system("wget -O /sync.sh https://huggingface.co/datasets/Qilan2/st-server/resolve/main/sync.sh")
|
| 94 |
os.system("export LC_ALL=zh_CN.UTF-8")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
# 更新软件包列表
|
| 96 |
def is_installed(package):
|
| 97 |
"""Check if a package is installed."""
|
|
@@ -433,7 +437,7 @@ def check_api1():
|
|
| 433 |
try:
|
| 434 |
# rsync -avz --port=7073 ljj@8.137.94.137::qilan /a/
|
| 435 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
| 436 |
-
subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{ssh_url}:{data_folder}/ {data_folder}/", shell=True, check=True)
|
| 437 |
except subprocess.CalledProcessError as e:
|
| 438 |
print(f"Rsync 失败,返回码: {e.returncode}")
|
| 439 |
print(f"Command output: {e.output}")
|
|
@@ -463,10 +467,6 @@ def check_api1():
|
|
| 463 |
|
| 464 |
def frp(configs, backstage):
|
| 465 |
print('-----------FRP开始-------------')
|
| 466 |
-
# 创建 FRP 文件夹并下载 frpc 可执行文件。
|
| 467 |
-
os.system("mkdir -p /content/frp")
|
| 468 |
-
os.system("wget /content/frp/frpc https://huggingface.co/Qilan2/box/resolve/main/frp/frpc -O /content/frp/frpc")
|
| 469 |
-
os.system("chmod +x /content/frp/frpc")
|
| 470 |
# 遍历所有配置并启动 FRP。
|
| 471 |
for config_data, config_file_path in configs:
|
| 472 |
with open(config_file_path, 'w') as config_file:
|
|
@@ -616,7 +616,7 @@ def SillyTavern():
|
|
| 616 |
generate_ssh_key()
|
| 617 |
copy_public_key_to_remote(frp_url, ssh_port, "root", "qilan")
|
| 618 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
| 619 |
-
subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{ssh_url}:{data_folder}/ {data_folder}/", shell=True, check=True)
|
| 620 |
# sys.exit()
|
| 621 |
else:
|
| 622 |
|
|
|
|
| 92 |
os.system("rm -r /sync.sh")
|
| 93 |
os.system("wget -O /sync.sh https://huggingface.co/datasets/Qilan2/st-server/resolve/main/sync.sh")
|
| 94 |
os.system("export LC_ALL=zh_CN.UTF-8")
|
| 95 |
+
# 创建 FRP 文件夹并下载 frpc 可执行文件。
|
| 96 |
+
os.system("mkdir -p /content/frp")
|
| 97 |
+
os.system("wget /content/frp/frpc https://huggingface.co/Qilan2/box/resolve/main/frp/frpc -O /content/frp/frpc")
|
| 98 |
+
os.system("chmod +x /content/frp/frpc")
|
| 99 |
# 更新软件包列表
|
| 100 |
def is_installed(package):
|
| 101 |
"""Check if a package is installed."""
|
|
|
|
| 437 |
try:
|
| 438 |
# rsync -avz --port=7073 ljj@8.137.94.137::qilan /a/
|
| 439 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
| 440 |
+
subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{ssh_url}:{data_folder}/ {data_folder}/", shell=True, check=True, timeout=300)
|
| 441 |
except subprocess.CalledProcessError as e:
|
| 442 |
print(f"Rsync 失败,返回码: {e.returncode}")
|
| 443 |
print(f"Command output: {e.output}")
|
|
|
|
| 467 |
|
| 468 |
def frp(configs, backstage):
|
| 469 |
print('-----------FRP开始-------------')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
# 遍历所有配置并启动 FRP。
|
| 471 |
for config_data, config_file_path in configs:
|
| 472 |
with open(config_file_path, 'w') as config_file:
|
|
|
|
| 616 |
generate_ssh_key()
|
| 617 |
copy_public_key_to_remote(frp_url, ssh_port, "root", "qilan")
|
| 618 |
# subprocess.run(f"rsync -avz --port=7075 ljj@{frp_url}::qilan {data_folder}/", shell=True, check=True)
|
| 619 |
+
subprocess.run(f"rsync -avz -e 'ssh -p {ssh_port} -o StrictHostKeyChecking=no' root@{ssh_url}:{data_folder}/ {data_folder}/", shell=True, check=True, timeout=300)
|
| 620 |
# sys.exit()
|
| 621 |
else:
|
| 622 |
|