HuggingFace0920 commited on
Commit
1d6559c
·
verified ·
1 Parent(s): 690077c

Update sync_data.sh

Browse files
Files changed (1) hide show
  1. 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
- with tarfile.open(filepath, 'r:gz') as tar:
70
- # 还原到根目录,确保 /mcp-proxy-server /tools 都能被还原
71
- tar.extractall("/")
72
- print(f"已成功恢复备份: {latest_backup}")
 
 
 
 
 
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