Created
January 31, 2023 09:43
-
-
Save cliffordwhansen/e86a20395bc1d800a6eda793b76c3166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Detect and install ipmitool (to be adjusted, this is run on an alpine system) | |
which ipmitool >/dev/null 2>&1 || (apk update && apk add ipmitool) | |
# IPMI hostname or IP address | |
IPMI_HOST=<<ipmi_ip_address>> | |
# IPMI username | |
IPMI_USER=<<username>> | |
# IPMI password | |
IPMI_PASS=<<password>> | |
# Check the system event log for errors | |
EVENT_LOG=$(ipmitool -I lanplus -H $IPMI_HOST -U $IPMI_USER -P $IPMI_PASS sel list) | |
# Check if the event log contains a specific error code | |
if echo "$EVENT_LOG" | grep -q "0x46"; then | |
# Restart the machine | |
ipmitool -I lanplus -H $IPMI_HOST -U $IPMI_USER -P $IPMI_PASS chassis power reset | |
# Clear the event log | |
ipmitool -I lanplus -H $IPMI_HOST -U $IPMI_USER -P $IPMI_PASS sel clear | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment