-
Notifications
You must be signed in to change notification settings - Fork 0
Description
#!/bin/bash
Function to check ACPI status and related messages
check_acpi() {
echo "Checking ACPI status..."
dmesg | grep -i "ACPI"
if [[ $? -ne 0 ]]; then
echo "No ACPI-related messages found in dmesg."
fi
Check for common ACPI errors in dmesg (expand as needed)
dmesg | grep -i "AE_AML_OPERAND_TYPE"
dmesg | grep -i "Needed [Buffer/String/Package]"
dmesg | grep -i "ACPI BIOS Error"
Check if acpid service is running (if applicable to your system)
if command -v systemctl &> /dev/null; then # Check if systemctl exists
if systemctl is-active acpid.service &> /dev/null; then
echo "acpid service is running."
else
echo "acpid service is NOT running."
if [[ $(systemctl --state=failed list-units acpid.service | wc -l) -gt 1 ]]; then
echo "acpid service failed. Check logs with: systemctl status acpid.service"
fi
fi
fi
}
Function to check CUPS status and logs
check_cups() {
echo "Checking CUPS status..."
if command -v systemctl &> /dev/null; then
systemctl status cups
if [[ $(systemctl --state=failed list-units cups.service | wc -l) -gt 1 ]]; then
echo "CUPS service failed. Check logs with: journalctl -xe | grep cups"
fi
else
echo "systemctl not found. CUPS check skipped (not a systemd system?)."
fi
echo "Checking CUPS error log..."
tail /var/log/cups/error_log
}
Function to check networkd status
check_networkd() {
echo "Checking systemd-networkd status..."
if command -v systemctl &> /dev/null; then
systemctl status systemd-networkd
if [[ $(systemctl --state=failed list-units systemd-networkd.service | wc -l) -gt 1 ]]; then
echo "systemd-networkd service failed. Check logs with: journalctl -xe | grep networkd"
fi
else
echo "systemctl not found. systemd-networkd check skipped (not a systemd system?)."
fi
}
Function to check PCI/XHCI status
check_pci_xhci() {
echo "Checking PCI/XHCI status..."
dmesg | grep -i "xhci"
dmesg | grep -i "pcieport"
if [[ $? -ne 0 ]]; then
echo "No xhci/pcieport related messages found in dmesg."
fi
}
Function to check D-Bus status
check_dbus() {
echo "Checking D-Bus status..."
if command -v systemctl &> /dev/null; then
systemctl status dbus
if [[ $(systemctl --state=failed list-units dbus.service | wc -l) -gt 1 ]]; then
echo "D-Bus service failed. Check logs with: journalctl -xe | grep dbus"
fi
else
echo "systemctl not found. D-Bus check skipped (not a systemd system?)."
fi
}
Main script execution
echo "Starting system health check..."
check_acpi
echo "--------------------"
check_cups
echo "--------------------"
check_networkd
echo "--------------------"
check_pci_xhci
echo "--------------------"
check_dbus
echo "System health check complete."
exit 0