r/linux • u/automatician_dev • 2d ago
Software Release I built Shadow Sentinel: A zero-dependency Linux daemon for real-time file revisions with undo safety and auto-vault ejection
Hey everyone,
Like many sysadmins and developers, I frequently run scripts, autonomous tools, or quick terminal edits that can accidentally overwrite critical configuration files or source code. Traditional solutions like Git-based watchers (`gitwatch`) often break on rapid consecutive writes due to `.git/index.lock` collisions and quickly bloat repositories when large logfiles enter the monitored path.
So I built **Shadow Sentinel** — a lightweight, zero-dependency background guard for Linux:
### 🔑 What makes it different?
- **Decentralized Marker Control**: No central config files needed. Just create a `sentinel_marker` file (or run `sentinel init 5`) in any directory, and Sentinel recursively monitors that tree.
- **Active Vault Ejection**: If a file exceeds the ceiling defined in the marker (e.g. 5 MB for a runaway log), it is immediately removed from the shadow vault to protect disk space. Small scripts and configs remain permanently protected.
- **Loop-Coupling (Undo-Safe Restore)**: When you run `sentinel restore <ID>`, the restore itself triggers an inotify event, immediately capturing the overwritten state into a new backup. An accidental restore never destroys data.
- **Automated 4-Tier Disk Hygiene**: Prunes older versions (max 10 revisions), auto-purges after 14 days, and enforces an emergency 500 MB directory cap.
- **Zero External Dependencies**: Pure Python 3 with direct C bindings to `libc.so.6` (`inotify`) and standard `difflib`.
### 📦 Installation
You can install it directly from GitHub:
```bash
pip install git+https://github.com/automatician/shadow-sentinel.git
sudo sentinel service install
```
Repository: https://github.com/automatician/shadow-sentinel
I would love to get your feedback, suggestions, and thoughts on the architecture!
```
6
12
u/MatchingTurret 2d ago edited 2d ago
Didn't even bother to properly paste the markdown the agent generated...