Skip to content

Automation followed by patching in server #51

@Siva420420

Description

@Siva420420

#!/bin/bash

Script Name: patch_validation.sh

Purpose: Validate if patching was applied successfully on a Linux server

Usage: Run as root or sudo user

echo "========== Patch Validation Report =========="

1. Show current date and hostname

echo "Date & Time: $(date)"
echo "Hostname: $(hostname)"

2. OS Version

echo -e "\n[+] OS Version:"
cat /etc/os-release

3. Kernel Version

echo -e "\n[+] Kernel Version:"
uname -r

4. Recently Installed Packages (Last 5)

echo -e "\n[+] Recently Installed Packages:"
rpm -qa --last | head -5

5. Yum/DNF History

echo -e "\n[+] Yum/DNF History (Last 3 Transactions):"
if command -v dnf &> /dev/null; then
dnf history list | head -n 10
else
yum history list | head -n 10
fi

6. System Logs Around Patch Time

echo -e "\n[+] Recent System Log Messages (last 20 lines):"
tail -n 20 /var/log/messages

7. Services Status Check (sample for sshd and crond)

echo -e "\n[+] Critical Services Status:"
for svc in sshd crond; do
systemctl is-active --quiet $svc && echo "$svc is running" || echo "$svc is NOT running"
done

8. Application or Custom Port Check (Example: 8080)

echo -e "\n[+] Check if app port 8080 is open:"
ss -tuln | grep ':8080' || echo "Port 8080 not listening"

9. Disk and Memory Check

echo -e "\n[+] Disk Usage:"
df -h

echo -e "\n[+] Memory Usage:"
free -h

echo -e "\n========== End of Report =========="

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions