ltxlong commited on
Commit
66a5fd3
·
verified ·
1 Parent(s): c8274dc

Update sync_data.sh

Browse files
Files changed (1) hide show
  1. sync_data.sh +3 -4
sync_data.sh CHANGED
@@ -60,9 +60,8 @@ sync_data() {
60
  echo "Starting sync process at $(date)"
61
 
62
  if [ -d /storage ]; then
63
- # 计算文件编号(0-23,每1小时递增1)(1个小时备份一次)
64
- FILE_NUMBER=$($(date +%H))
65
- backup_file="reader_backup_${FILE_NUMBER}.tar.gz"
66
 
67
  # 压缩数据目录
68
  tar -czf "/tmp/${backup_file}" -C /storage .
@@ -75,7 +74,7 @@ sync_data() {
75
  echo "Failed to upload ${backup_file} to WebDAV"
76
  fi
77
 
78
- # 清理旧备份文件
79
  python3 -c "
80
  import sys
81
  from webdav3.client import Client
 
60
  echo "Starting sync process at $(date)"
61
 
62
  if [ -d /storage ]; then
63
+ timestamp=$(date +%Y%m%d_%H%M%S)
64
+ backup_file="reader_backup_${timestamp}.tar.gz"
 
65
 
66
  # 压缩数据目录
67
  tar -czf "/tmp/${backup_file}" -C /storage .
 
74
  echo "Failed to upload ${backup_file} to WebDAV"
75
  fi
76
 
77
+ # 清理旧备份文件,仅保留最新的2份
78
  python3 -c "
79
  import sys
80
  from webdav3.client import Client