惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Martin Fowler
Martin Fowler
H
Help Net Security
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 最新话题
S
Schneier on Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
The Hacker News
The Hacker News
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
SecWiki News
SecWiki News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42
Attack and Defense Labs
Attack and Defense Labs
Security Latest
Security Latest
Help Net Security
Help Net Security
博客园 - Franky
L
LINUX DO - 热门话题
N
News and Events Feed by Topic
Cloudbric
Cloudbric
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 【当耐特】
Schneier on Security
Schneier on Security
Google Online Security Blog
Google Online Security Blog
C
Cisco Blogs
Webroot Blog
Webroot Blog
C
CERT Recently Published Vulnerability Notes
Simon Willison's Weblog
Simon Willison's Weblog
A
Arctic Wolf
O
OpenAI News
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Last Watchdog
The Last Watchdog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Stop Manually Checking for Server Updates: Automate With Email Notifications
Smyekh David · 2026-05-25 · via DEV Community

☁️ Pre-Flight Checklist

Before we taxi down the runway, here’s your flight plan. Keep this handy to navigate your flight path. Welcome aboard the cloud!

🌥️ Takeoff

⛅️ Cruising Altitude

🌤️ Landing & Taxi

Enjoy your flight! ☁️


You're running a production server. It's humming along fine. Memory is healthy at 27%, disk usage is reasonable, and your containers are all green. Then one morning you realise you haven't checked for updates in three weeks.

Sound familiar? Most DevOps engineers face this pattern: updates pile up, you forget to check, and when you finally remember, there's a backlog of patches waiting. The real problem isn't the updates themselves — it's the absence of a signal telling you they exist.

In this article, I'll walk you through setting up an automated weekly server health report that lands in your inbox every Sunday morning, complete with pending updates, disk usage, and memory stats. No more manual checks. No more forgotten patches.

Why Automation Matters for Updates

Before diving into the how, let's talk about the why. In production environments, staying on top of updates isn't optional — it's a security and stability requirement. But checking manually creates friction:

  • You remember sporadically, if at all
  • Updates pile up and become harder to review
  • When you finally apply them, there's a larger blast radius
  • You miss the pattern of what's actually changing on your system

The solution is dead simple: let the system tell you when it needs attention. A weekly email report transforms this from a thing you have to remember into a thing that pulls your attention at a consistent time.

The Architecture

Here's what we're building:

A Bash script runs every Sunday at 6am UTC (customisable to your timezone). It checks for available updates, captures disk and memory usage, and emails you a digest. You review the list during your morning coffee, and if nothing is urgent, you schedule the updates for a low-traffic window. If there are security patches, you can apply them immediately.

The beauty of this approach is that it's dead simple — just a few bash commands, a Gmail app password, and a cron job. No external services, no complex infrastructure.

Prerequisites

You'll need:

  • An Ubuntu server (22.04 or later works fine) SSH access with sudo privileges
  • A Gmail account with 2FA enabled (for the app password)
  • About 10 minutes of setup time

This approach works on OCI, AWS, DigitalOcean, or any Ubuntu VPS. The only external dependency is Gmail's SMTP server, which is rock solid.

Step 1: Create a Gmail App Password

Gmail's SMTP server requires authentication. Instead of using your actual Gmail password, you create an app-specific password that you can revoke later if needed.

First, enable 2-Step Verification on your Google Account if you haven't already. Then:

  1. Go to your Google Account → Security
  2. Scroll to "App passwords" (only visible if 2FA is enabled)
  3. Select "Mail" and "Windows Computer" (the actual device doesn't matter)
  4. Google generates a 16-character password like lqxu mdsxjwbj mast
  5. Copy this password as you'll use it in the next step.

This approach is much safer than storing your actual Gmail password on the server.

Step 2: Install Mail Utilities

SSH into your server and install the tools we need:

sudo apt-get update
sudo apt-get install -y msmtp msmtp-mta mailutils

Enter fullscreen mode Exit fullscreen mode

This installs msmtp (a lightweight mail client), msmtp-mta (a mail transport agent), and mailutils (mail utilities). The download is about 70MB and takes a minute or two.

Step 3: Configure Gmail SMTP

Create the msmtp configuration file:

sudo nano /etc/msmtprc

Enter fullscreen mode Exit fullscreen mode

Paste this configuration, replacing the placeholder email and password with yours:

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        /var/log/msmtp.log

account        gmail
host           smtp.gmail.com
port           587
from           your-email@gmail.com
user           your-email@gmail.com
password       your-app-password-here

account default: gmail

Enter fullscreen mode Exit fullscreen mode

The key points here:

  • auth on enables SMTP authentication tls on encrypts the connection
  • port 587 is Gmail's submission port (not 25 or 465)
  • password is the 16-character app password (without spaces)

Save this file with Ctrl + O, then Enter, then Ctrl + X.

Now lock down the file so only root can read it:

sudo chmod 600 /etc/msmtprc

Enter fullscreen mode Exit fullscreen mode

This is important because the file contains your credentials.

Step 4: Create the Update Notification Script

Create a new script that will gather server stats and send you an email:

sudo nano /usr/local/bin/update-notify.sh

Enter fullscreen mode Exit fullscreen mode

Paste this script:

#!/bin/bash
RECIPIENT="your-email@gmail.com"
HOSTNAME=$(hostname)

# Refresh package lists
apt-get update -qq

# Get the list of upgradable packages
UPDATES=$(apt list --upgradable 2>/dev/null | grep -v "Listing...")
COUNT=$(echo "$UPDATES" | grep -c "/" || true)

# Get system stats
DISK=$(df / | awk 'NR==2 {print $5}')
MEMORY=$(free -h | awk '/^Mem:/ {print $3 "/" $2}')

# Send email with all the information
echo -e "Subject: [$HOSTNAME] Weekly Server Report\n\nDisk: $DISK\nMemory: $MEMORY\nPending updates: $COUNT\n\n$UPDATES" \
  | msmtp "$RECIPIENT"

Enter fullscreen mode Exit fullscreen mode

Let me break down what this script does:

The first section sets your email address and gets the hostname so you can identify which server the email came from. The apt-get update -qq silently refreshes the package lists without noisy output.

The second section uses apt list --upgradable to get all available updates and counts them. We filter out the "Listing..." header line that apt adds.

The third section captures two key metrics: disk usage (as a percentage) and current memory usage (like 1.4Gi/11Gi). These give you a weekly pulse on resource usage.

Finally, we construct an email with all this information and pipe it through msmtp. The format is deliberate — the subject line includes the hostname so you can glance at the email and know which server it's from.

Save the file and make it executable:

sudo chmod +x /usr/local/bin/update-notify.sh

Enter fullscreen mode Exit fullscreen mode

Step 5: Test the Script

Before scheduling it in cron, test it manually:

sudo /usr/local/bin/update-notify.sh

Enter fullscreen mode Exit fullscreen mode

Check your inbox (may take 10-30 seconds). You should receive an email titled [your_hotname] Weekly Server Report with your disk, memory, and update counts.

If the email doesn't arrive, check the msmtp log:

sudo cat /var/log/msmtp.log

Enter fullscreen mode Exit fullscreen mode

Common issues:

  • Authentication failed: Your app password is wrong. Double-check it in Gmail's security settings, and make sure you removed spaces when pasting it into msmtprc.

  • TLS error: Less common, but if you see this, try tls_trust_file /etc/ssl/certs/ca-certificates.crt (which is already in the config above).

  • Timeout: Your firewall might be blocking port 587. Contact your hosting provider or check firewall rules.

Once the test email arrives, you're ready to schedule it.

Step 6: Schedule With Cron

echo "0 6 * * 0 root /usr/local/bin/update-notify.sh" | sudo tee /etc/cron.d/update-notify

Enter fullscreen mode Exit fullscreen mode

Breaking down the cron expression 0 6 * * 0:

  • 0 = minute 0
  • 6 = hour 6 (UTC)
  • * = any day of month
  • * = any month
  • 0 = Sunday

So this runs at 6am UTC every Sunday. Want 8am instead? Change the 6 to 8. Want Monday? Change 0 to 1.

You can verify the job is scheduled:

sudo cat /etc/cron.d/update-notify

Enter fullscreen mode Exit fullscreen mode

Understanding Your Update Report

Email Sample

When the email arrives, you'll see something like:

Disk: 28%
Memory: 1.4Gi/11Gi
Pending updates: 9

containerd.io/jammy 2.2.4-1~ubuntu.22.04~jammy arm64 [upgradable from: 2.2.3-1~ubuntu.22.04~jammy]
docker-ce/jammy 5:29.5.2-1~ubuntu.22.04~jammy arm64 [upgradable from: 5:29.5.1-1~ubuntu.22.04~jammy]
docker-ce-cli/jammy 5:29.5.2-1~ubuntu.22.04~jammy arm64 [upgradable from: 5:29.5.1-1~ubuntu.22.04~jammy]
...

Enter fullscreen mode Exit fullscreen mode

Here's how to interpret it:

Disk at 28% means you're using 28% of available space. Generally, you want to stay below 80% — above that and your system can get sluggish. If you see disk usage above 90%, you should start cleaning up immediately, as you're running dangerously low on free space.

Memory at 1.4Gi/11Gi means you're using 1.4 gigabytes out of 11 gigabytes available. For most workloads, anything under 80% is healthy. If you regularly see 90%+, your containers might be memory-constrained.

Pending updates: 9 tells you how many packages have updates available. This is where you make a decision: are they security patches or minor version bumps? The detailed list below helps you decide.

The package list shows exactly what's available. Look for the word "security" in the version — those should go to the front of your queue. Docker updates are usually safe to apply, but they may require a daemon restart. System library updates are generally safe on non-kernel packages.

Applying Updates Safely

Once a week you'll get this email. Here's the decision tree:

If there are only security updates: Apply them as soon as possible. These are critical.

sudo apt-get upgrade -y

Enter fullscreen mode Exit fullscreen mode

If it's mostly minor version bumps (like Docker 29.5.1 → 29.5.2): Apply them during your next scheduled maintenance window, or wait until the following week if you prefer to batch them.

If there are kernel updates: Kernel updates require a reboot. Schedule them during a low-traffic window and plan for a few minutes of downtime.

If there are no updates: Great! Your email will tell you everything is current, so you can relax for another week.

After applying updates, verify your containers are still healthy:

sudo docker ps --format "table {{.Names}}\t{{.Status}}"

Enter fullscreen mode Exit fullscreen mode

You want to see "Up" for all your services. If something crashed, you'll see "Exited" or an error state, which tells you something went wrong with the update.

Pro Tips

Customise the timing: Change the 6 in the cron expression to whatever time works for you. I recommend early morning (before traffic peaks) so you can apply critical updates if needed.

Add more metrics: The script can be extended to include CPU load, network stats, or Docker container count. Just add more lines that echo to the email.

Combine with unattended-upgrades: For security patches only, you can use Ubuntu's unattended-upgrades to apply them automatically at 3am and reserve your weekly email for the rest. This gives you defence in depth without manual effort.

Monitor the logs: If you want to see what was emailed and when, check:

sudo tail -f /var/log/msmtp.log

Enter fullscreen mode Exit fullscreen mode

Revoke the app password: If you ever suspect it's been compromised, delete it in Gmail's security settings and generate a new one. The old password immediately stops working.

Wrapping Up

You've now got a system that pulls server health to your attention on a predictable schedule. No more guessing when to check. No more surprises from stale updates. Every Sunday morning, you get a digest that tells you exactly what needs attention.

This approach scales from one server to dozens. If you manage multiple machines, you can set each one up with its own cron job, and you'll get separate emails for each server. The subject line includes the hostname, so you can quickly triage across your fleet.

The setup takes about 10 minutes the first time. After that, it runs on autopilot. That's the beauty of automation – small upfront investment, big payoff over time.

Your future self will thank you when you're not scrambling to remember the last time you patched production.


Cover photo by Taylor Vick on Unsplash