playingapi commited on
Commit
0d5f083
·
verified ·
1 Parent(s): 1026e4c

Update sync_data.sh

Browse files
Files changed (1) hide show
  1. sync_data.sh +3 -3
sync_data.sh CHANGED
@@ -60,7 +60,7 @@ def download_latest_backup(token, repo_id):
60
 
61
  if filepath and os.path.exists(filepath):
62
  os.makedirs('/app/db', exist_ok=True)
63
- os.system(f'cp "{filepath}" /app/db/pandora.db')
64
  print(f"成功从 {latest_backup} 恢复备份")
65
 
66
  except Exception as e:
@@ -88,12 +88,12 @@ sync_data() {
88
  while true; do
89
  echo "开始同步进程 $(date)"
90
 
91
- if [ -f "/app/db/pandora.db" ]; then
92
  timestamp=$(date +%Y%m%d_%H%M%S)
93
  backup_file="pandora_backup_${timestamp}.db"
94
 
95
  # 复制数据库文件
96
- cp /app/db/pandora.db "/tmp/${backup_file}"
97
 
98
  echo "正在上传备份到 Hugging Face..."
99
  python3 /tmp/hf_sync.py upload "${HF_TOKEN}" "${DATASET_ID}" "/tmp/${backup_file}" "${backup_file}"
 
60
 
61
  if filepath and os.path.exists(filepath):
62
  os.makedirs('/app/db', exist_ok=True)
63
+ os.system(f'cp "{filepath}" /app/db/data.db')
64
  print(f"成功从 {latest_backup} 恢复备份")
65
 
66
  except Exception as e:
 
88
  while true; do
89
  echo "开始同步进程 $(date)"
90
 
91
+ if [ -f "/app/db/data.db" ]; then
92
  timestamp=$(date +%Y%m%d_%H%M%S)
93
  backup_file="pandora_backup_${timestamp}.db"
94
 
95
  # 复制数据库文件
96
+ cp /app/db/data.db "/tmp/${backup_file}"
97
 
98
  echo "正在上传备份到 Hugging Face..."
99
  python3 /tmp/hf_sync.py upload "${HF_TOKEN}" "${DATASET_ID}" "/tmp/${backup_file}" "${backup_file}"