Update sync_data.sh
Browse files- sync_data.sh +9 -4
sync_data.sh
CHANGED
|
@@ -66,10 +66,15 @@ def download_latest_backup(token, repo_id, extract_path):
|
|
| 66 |
local_dir=temp_dir
|
| 67 |
)
|
| 68 |
if filepath and os.path.exists(filepath):
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
except Exception as e:
|
| 74 |
print(f"下载备份出错: {str(e)}")
|
| 75 |
|
|
|
|
| 66 |
local_dir=temp_dir
|
| 67 |
)
|
| 68 |
if filepath and os.path.exists(filepath):
|
| 69 |
+
try:
|
| 70 |
+
with tarfile.open(filepath, 'r:gz') as tar:
|
| 71 |
+
# 还原到根目录,确保 /mcp-proxy-server 和 /tools 都能被还原
|
| 72 |
+
tar.extractall("/")
|
| 73 |
+
print(f"已成功恢复备份: {latest_backup}")
|
| 74 |
+
except PermissionError as e:
|
| 75 |
+
print(f"解压备份时权限不足: {str(e)},请确保容器有写入根目录的权限。")
|
| 76 |
+
except Exception as e:
|
| 77 |
+
print(f"解压备份时出错: {str(e)}")
|
| 78 |
except Exception as e:
|
| 79 |
print(f"下载备份出错: {str(e)}")
|
| 80 |
|