Skip to content

定义parses备份与恢复,方便定制用户 #21

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 10, 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
定义parses备份与恢复,方便定制用户
定义parses备份与恢复,方便定制用户
  • Loading branch information
sanshu-rom authored Jan 10, 2025
commit dcad84048dca11169df18f1cc0862bbc9900a268
29 changes: 29 additions & 0 deletions autorun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,18 @@ backup_files_and_cookie_auth_code() {
echo -e "${RED}备份map.txt文件失败。${NC}"
exit 1
fi

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

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

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

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