Skip to content

定义map定制备份恢复 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions autorun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,18 @@ backup_files_and_cookie_auth_code() {
echo -e "${RED}备份.env文件失败。${NC}"
exit 1
fi

# 备份map.txt文件
local map_txt_path="$REPO_DIR/$PROJECT_NAME/config/map.txt"
local map_txt_backup_file="map.txt.backup_$(date +%Y%m%d)"
echo -e "${YELLOW}正在备份map.txt文件...${NC}"
cp "$map_txt_path" "./$map_txt_backup_file"
if [ $? -eq 0 ]; then
echo -e "${GREEN}map.txt文件已备份为 $map_txt_backup_file${NC}"
else
echo -e "${RED}备份map.txt文件失败。${NC}"
exit 1
fi
}

# 定义恢复函数
Expand Down Expand Up @@ -408,6 +420,23 @@ restore_env_json_and_cookie_auth_code() {
echo -e "${RED}备份文件 $env_backup_file 不存在,无法恢复.env文件。${NC}"
exit 1
fi

# 恢复map.txt文件
local map_txt_backup_file="map.txt.backup_$(date +%Y%m%d)"
if [ -f "./$map_txt_backup_file" ]; then
echo -e "${YELLOW}正在恢复map.txt文件...${NC}"
cp "./$map_txt_backup_file" "$REPO_DIR/$PROJECT_NAME/config/map.txt"
if [ $? -eq 0 ]; then
echo -e "${GREEN}map.txt文件已恢复。${NC}"
rm "./$map_txt_backup_file" # 删除备份文件
else
echo -e "${RED}恢复map.txt文件失败。${NC}"
exit 1
fi
else
echo -e "${RED}备份文件 $map_txt_backup_file 不存在,无法恢复map.txt文件。${NC}"
exit 1
fi
}

# 尝试次数限制,避免无限循环
Expand Down