File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -689,7 +689,7 @@ log_info " 停止服务: cd ${TEMP_COMPOSE_DIR} && docker-compose -f ${COMPOSE_
689689COMPOSE_EOF
690690 else
691691 # 为普通容器创建恢复脚本
692- cat > " ${backup_dir} /restore.sh" << ' EOF '
692+ cat > " ${backup_dir} /restore.sh" << EOF
693693#!/bin/bash
694694
695695# Docker容器恢复脚本
934934
935935log_success "容器恢复完成!"
936936EOF
937+ fi
937938
938939 chmod +x " ${backup_dir} /restore.sh"
939940 log_success " 恢复脚本创建完成"
@@ -1125,8 +1126,12 @@ main() {
11251126 mkdir -p " ${BACKUP_DIR} "
11261127
11271128 # 获取要备份的容器列表
1128- local containers_to_backup
1129- mapfile -t containers_to_backup < <( get_containers)
1129+ local containers_to_backup=()
1130+ while IFS= read -r container; do
1131+ if [[ -n " $container " ]]; then
1132+ containers_to_backup+=(" $container " )
1133+ fi
1134+ done < <( get_containers)
11301135
11311136 if [[ ${# containers_to_backup[@]} -eq 0 ]]; then
11321137 log_warning " 未找到要备份的容器"
You can’t perform that action at this time.
0 commit comments