disaster-recovery

disaster-recovery is a skill for Claude Code, Codex from chaterm/terminal-skills. It costs 8 tokens per session (1,451 once invoked), scanned A, original, Apache-2.0.

A disaster-recovery guide for restoring databases, files, and systems after a serious failure. It explains RPO, the amount of data you can afford to lose, and RTO, how quickly recovery must happen.

In plain words
What is it for?
Use it to plan recovery for MySQL, PostgreSQL, Redis, filesystems, and system boot problems, including backups, point-in-time recovery, and failover.
Why use it?
It helps replace improvised recovery with a plan based on acceptable data loss and downtime. It also outlines cold, warm, and hot backup strategies.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to plan recovery for MySQL, PostgreSQL, Redis, filesystems, and system boot problems, including backups, point-in-time recovery, and failover.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chaterm/terminal-skills/disaster-recovery
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chaterm/terminal-skills --skill disaster-recovery
Clone the repo
git clone --depth 1 https://github.com/chaterm/terminal-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for disaster-recovery

README.md
[![agentmods](https://agentmods.dev/badge/skills/chaterm/terminal-skills/disaster-recovery/github.svg)](https://agentmods.dev/skills/chaterm/terminal-skills/disaster-recovery)
Your own site
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/disaster-recovery"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/disaster-recovery/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for disaster-recovery

Your own site · 80×15
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/disaster-recovery"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/disaster-recovery.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 8 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,451 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00008 $0.01451
Opus 5 $0.00004 $0.00726
Sonnet 5 $0.00002 $0.00290
Haiku 4.5 $0.00001 $0.00145

Measured 12d ago against content hash df6eed5ffd9f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

disaster-recovery scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s http://localhost/health
backup/disaster-recovery/SKILL.md · 260 lines

How it starts

The opening of the file, as written. The whole thing — 260 lines — stays where its author put it; the contents beside it link to each section on GitHub.

灾难恢复

概述

灾难恢复计划、RTO/RPO、故障切换技能。

核心概念

RTO 与 RPO

RPO (Recovery Point Objective)
- 可接受的数据丢失量
- 决定备份频率

RTO (Recovery Time Objective)  
- 可接受的恢复时间
- 决定恢复策略

示例:
- RPO = 1小时 → 每小时备份
- RTO = 4小时 → 需要热备或快速恢复

恢复策略

冷备 (Cold)
- 最低成本
- 最长 RTO
- 适合非关键系统

温备 (Warm)
- 中等成本
- 中等 RTO
- 定期同步数据

热备 (Hot)
- 最高成本
- 最短 RTO
- 实时同步

数据库恢复

MySQL 恢复

# 从备份恢复
mysql -u root -p < full_backup.sql

# 应用 binlog
mysqlbinlog mysql-bin.000001 | mysql -u root -p

# 时间点恢复
mysqlbinlog --stop-datetime="2024-01-15 10:00:00" mysql-bin.* | mysql -u root -p

# 主从切换
# 在从库执行
STOP SLAVE;
RESET SLAVE ALL;
# 应用程序切换连接

PostgreSQL 恢复

# 从备份恢复
pg_restore -d database backup.dump

# PITR 恢复
# recovery.conf
restore_command = 'cp /archive/%f %p'
recovery_target_time = '2024-01-15 10:00:00'

# 主从切换
pg_ctl promote -D /var/lib/postgresql/data

Redis 恢复

# 从 RDB 恢复
cp backup.rdb /var/lib/redis/dump.rdb
systemctl restart redis

# 从 AOF 恢复
cp backup.aof /var/lib/redis/appendonly.aof
redis-check-aof --fix appendonly.aof
systemctl restart redis

系统恢复

文件系统恢复

# 从 tar 备份恢复
tar -xzvf /backup/system.tar.gz -C /

# 从 rsync 备份恢复
rsync -avz /backup/system/ /

# 恢复权限
restorecon -Rv /

引导修复

# 进入救援模式
# 挂载根分区
mount /dev/sda1 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt

# 修复 GRUB
grub-install /dev/sda
update-grub

故障切换

Keepalived 切换

# 检查状态
systemctl status keepalived
ip addr show | grep -w inet

# 手动切换
# 降低主节点优先级
# /etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
    priority 50  # 降低
}
systemctl reload keepalived

DNS 切换

# 修改 DNS 记录
# 降低 TTL(提前)
# 切换 A 记录指向备用 IP

# 验证
dig +short example.com
nslookup example.com

常见场景

场景 1:完整恢复流程

#!/bin/bash
# 1. 评估损失
echo "检查系统状态..."

# 2. 通知相关人员
# send_alert "开始灾难恢复"

# 3. 恢复基础设施
echo "恢复网络配置..."

# 4. 恢复数据
echo "恢复数据库..."
mysql -u root -p < /backup/latest.sql

# 5. 恢复应用
echo "启动应用服务..."
systemctl start application

# 6. 验证
echo "验证服务状态..."
curl -s http://localhost/health

# 7. 通知恢复完成
# send_alert "灾难恢复完成"

Read the full file on GitHub · 260 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 260 lines · 8 tokens per session scan A df6eed5ffd9f

Subscribe to this mod's changes

disaster-recovery is a skill published in the GitHub repository chaterm/terminal-skills (59 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 8 tokens to every session and 1,451 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.