Static site generation anti-overwrite protection

If your site isRegenerated by scheduled tasks(Crawler fetches data → generates HTML → copies to site directory); thus, there is a hard rule:Never directly modify the generated HTML.. We learned this the hard way on rentgpu.link: 876 manually edited pages were overwritten in one cron run, wiping out hours of work. This tool generates a guard script to detect manual edits to output and provides a workflow that preserves your work.

Free · No login required Local generation · Content is not uploaded Corresponding incident · 876 pages were overwritten by cron.

1Directories and commands

RememberThe only correct modification process

Output 1Guard script guard.sh

0 lines
—
Place into /usr/local/bin/guard.sh, run once first guard.sh snapshot establishes the baseline, then mount guard.sh check to cron.

Output 2crontab configuration

0 lines
—

Self-checkIs your generation site secure?

We’ve fallen into this trap

1 · 876 pages were overwritten in one go.On rentgpu.link, we directly edited 876 generated HTML files. At 18:07 on that day, the scheduled job ran and overwrote all changes—becauseOutputs are not the data source; generator templates are.. The correct approach is to modify scripts/build_site.py templates inside, then manually run generation + publishing again.

2 · Multilingual outputs must be updated together.The same site has /en /ja /ko /tw Four artifact sets, total 766 pages. Only the Chinese set is modified; other language versions become inconsistent.

3 · You thought “the change didn’t take effect,” but it was actually overwritten.Start troubleshooting with grep Verify artifact directory contents first, then check cron logs—saves one hour.

4 · Perform a full-package backup before making changes.We always first tar czf /root/backups/xxx-$(date +%s).tar.gz <directory>Rollback takes only 30 seconds.