π₯ No More Silent Server Restarts: My Lightweight Python Notifier
π The Problem
Servers would restart. Services would silently fail.
And nobody would know until users started complaining.
I built this while working at VectorFlow, where physical access systems ran on Linux servers that occasionally restarted without warning β and downtime meant real-world security delays.
Logs were too noisy. Traditional monitoring tools missed it.
We needed a way to know β the second a server came back up.
π οΈ The Fix: 10 Lines of Python + a Cron Job
I built a lightweight script that:
- β
Runs at boot via crontab (`@reboot`)
- β
Captures server hostname, timestamp, and uptime
- β
Sends an email alert with restart details
- β
Logs every restart in a local file (for postmortems)
Itβs tiny. Itβs fast. And it just works.
π¬ GitHub Link
You can grab the open-source version here:
π
github.com/chinmaya-chhatre/server-restart-notifier
π What Changed
- β±οΈ Time-to-detect server restarts dropped to < 1 min
- π§ Instant alerts helped correlate uptime with other logs
- π‘ Reduced false positives and alert fatigue by keeping it simple
βοΈ Tradeoffs I Made
- Simple Over Smart: No agent, no daemon, no bloat β just Python + crontab
- Email Over Slack: Chose email to avoid adding webhook dependencies (but extensible)
- No External Monitoring: Works offline and boots with the system β self-contained by design
π§ What I'd Add Next
- π’ Add a webhook to integrate with Slack or Discord
- π Forward logs to ELK or CloudWatch for central visibility
- π Add signature hash to verify alert authenticity (optional)
π§΅ Why Iβm Sharing This
Because not every solution needs a $99/month SaaS tool.
Because every SRE has lost time to βmystery restarts.β
And because sometimes, a 10-line script can prevent a production fire.
π Bonus Links