优化TG通知:开始、快照完成、同步完成分步通知
This commit is contained in:
@@ -250,7 +250,6 @@ create_snapshot() {
|
|||||||
|
|
||||||
mkdir -p "$LOCAL_DIR"
|
mkdir -p "$LOCAL_DIR"
|
||||||
log "创建快照: $snapshot_name"
|
log "创建快照: $snapshot_name"
|
||||||
send_telegram "🔄 <b>开始备份</b>%0AVPS: ${VPS_NAME}"
|
|
||||||
|
|
||||||
local excludes="--exclude=/proc --exclude=/sys --exclude=/dev"
|
local excludes="--exclude=/proc --exclude=/sys --exclude=/dev"
|
||||||
excludes+=" --exclude=/run --exclude=/tmp --exclude=/mnt"
|
excludes+=" --exclude=/run --exclude=/tmp --exclude=/mnt"
|
||||||
@@ -299,15 +298,22 @@ run_backup() {
|
|||||||
local start=$(date +%s)
|
local start=$(date +%s)
|
||||||
|
|
||||||
log "===== 开始备份 [$VPS_NAME] ====="
|
log "===== 开始备份 [$VPS_NAME] ====="
|
||||||
|
send_telegram "🔄 <b>开始备份</b>%0AVPS: ${VPS_NAME}%0A时间: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
|
||||||
local snapshot=$(create_snapshot)
|
local snapshot=$(create_snapshot)
|
||||||
|
local size=$(du -h "$snapshot" | cut -f1)
|
||||||
|
local filename=$(basename "$snapshot")
|
||||||
|
|
||||||
|
send_telegram "📦 <b>快照完成</b>%0AVPS: ${VPS_NAME}%0A文件: ${filename}%0A大小: ${size}%0A开始同步到远程..."
|
||||||
|
|
||||||
sync_to_remote "$snapshot"
|
sync_to_remote "$snapshot"
|
||||||
cleanup_local
|
cleanup_local
|
||||||
cleanup_remote
|
cleanup_remote
|
||||||
|
|
||||||
local dur=$(($(date +%s) - start))
|
local dur=$(($(date +%s) - start))
|
||||||
local size=$(du -h "$snapshot" | cut -f1)
|
local remote_path="${REMOTE_DIR}/${filename}"
|
||||||
log "===== 备份完成 ====="
|
log "===== 备份完成 ====="
|
||||||
send_telegram "✅ <b>备份完成</b>%0AVPS: ${VPS_NAME}%0A大小: ${size}%0A耗时: ${dur}秒"
|
send_telegram "✅ <b>备份完成</b>%0AVPS: ${VPS_NAME}%0A大小: ${size}%0A耗时: ${dur}秒%0A远程: ${REMOTE_IP}:${remote_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user