Update sync_data.sh
Browse files- 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 |
-
|
| 64 |
-
|
| 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
|