Files
homelab-monitoring/scripts/check-updates.sh
PVE Monitoring System 3a14fd2736 Initial backup: 18 monitoring scripts + timers + docs
- 18 comprehensive monitoring checks
- 5 systemd timers (5min, 15min, hourly, daily, weekly)
- Complete documentation
- NTFY secure notification system
- Fixed debianvm disk space (91% to 57%)
- Fixed CloudReve integration
- Date: 2026-01-07
2026-01-07 16:30:34 +08:00

21 lines
859 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Check for available system updates
set -euo pipefail
SEND_NTFY="/usr/local/bin/send-ntfy.sh"
# Update package cache
apt-get update -qq >/dev/null 2>&1 || true
# Count available updates
REGULAR_UPDATES=$(apt list --upgradable 2>/dev/null | grep -c "upgradable" || echo "0")
SECURITY_UPDATES=$(apt list --upgradable 2>/dev/null | grep -ic "security" || echo "0")
if [ "$SECURITY_UPDATES" -gt 0 ]; then
$SEND_NTFY warning "Security Updates Available" "🟡 WARNING: $SECURITY_UPDATES security update(s) available on PVE\nTotal updates: $REGULAR_UPDATES" "warning,package,shield"
elif [ "$REGULAR_UPDATES" -gt 10 ]; then
$SEND_NTFY info "System Updates Available" " INFO: $REGULAR_UPDATES system update(s) available on PVE" "package,info"
fi
logger -t updates-monitor "Updates: $REGULAR_UPDATES total, $SECURITY_UPDATES security"