http://bash.cyberciti.biz/monitoring/mcelog-shell-script-to-send-email-alert/
#!/bin/bash
# Linux 64 bit kernel shell script to collect hardware errors via /var/log/mcelog
# and send email alert.
# -------------------------------------------------------------------------
# Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Tested under RHEL and Debian Linux 64 bit version.
# mcelog must be installed.
# See: http://www.cyberciti.biz/tips/linux-server-predicting-hardware-failure.html
LOGGER=/usr/bin/logger
FILE=/var/log/mcelog
AEMAIL="vivek@nixcraft.net.in"
ASUB="H/W Error - $(hostname)"
AMESS="Warning - Hardware errors found on $(hostname) @ $(date). See log file for the details /var/log/mcelog."
OK_MESS="$0 - OK: NO Hardware Error Found."
WARN_MESS="$0 - ERROR: Hardware Error Found."
die(){
echo "$@"
exit 999
}
warn(){
echo $AMESS | email -s "${ASUB}" ${AEMAIL}
$LOGGER "$WARN_MESS"
}
[ ! -f "$FILE" ] && die "Error - No $FILE exists or mcelog is not configured"
[ $(grep -c -i "hardware error" $FILE) -gt 0 ] && warn || $LOGGER $OK_MESS
分享到:
相关推荐
Redirect input, output, and errors of a command or script execution to other streams Debug code with different shell debugging techniques to make your scripts bug-free Manage processes, along with the...
Discover how to write shell scripts easily, execute script files, debug, and handle errors. Next, you’ll explore environment variables in shell programming and learn how to customize them and add a...
9)....Added: EMemLeaks._ReserveOutOfMemory to control reserve size of out of memory errors (default is 50 Mb) 10)..Added: "MinLeaksLimitObjs" option (EMemLeaks unit) 11)..Added: Fatal memory problem ...
errors code
How_to_avoid_common_errors_and_make_program_efficient[1][1]..pdf
Bugs as deviant behavior__a general approach to inferring errors in systems code
- bugfix: Share: An alert is shown when adding an email to the share list - bugfix: Slimey always saves as a new document Since 1.2.1 ----------- - feature: Billing Module. Allows defining ...
exceptions for programming errors Item 71: Avoid unnecessary use of checked exceptions Item 72: Favor the use of standard exceptions Item 73: Throw exceptions appropriate to the abstraction Item 74: ...
corrected parsing errors when using -XX:+PrintGCDateStamps corrected parsing errors when icms_dc=NN appears in GC-log tested so far only with this combination of parameters: -XX:+UseConcMarkSweepGC -...
The fact that MyMalloc() and MyFree() are given the filename and line number of the MALLOC() and FREE() call can prove to be very useful when you are reporting errors. The more information you print ...
# all warnings being treated as errors ## 技巧 在ubuntu系统下编译一个程序包,有时会遇到这样的错误: $ make ... cc1: all warnings being treated as errors
* Easy * Efficient * Beginners * Are you aware that C Programming is one of the most popular and most commonly used ... Common C Programming Errors. Chapter 23. Live Software Development Using C.
Even though this book isn’t a “how to script” manual, some concepts that are fundamental to writing successful scripts should be discussed. Debugging is one of them. Debugging code is a significant...
* fixed: errors were meant to be output to stderr, but they weren't * fixed: automatic gap/overlap fixing with AAC targets aborted processing * fixed: positive edit began a bit too early * fixed: two ...
测试忽略证书错误atom-shell --ignore-certificate-errors 开关的独立测试克隆,然后像这样安装和运行 npm installgulp webservers # in one terminalgulp tests # in a second terminal您需要在路径中的某处使用...
cfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.gocfg_errors.go
- Enhanced the mechanism to report memory hardware errors in the Memory torture test. Release 5.3 build 1033 WIN32 release 1 October 2008 - Changes to correct a BurnInTest crash problem on some ...
EmptyDataError: No columns to parse from file报错 原因和解决办法: 是因为你之前下载这个数据集的时候,中断了,已经产生了一个iris.csv的空文件在home家目录下面,你只需要去home家目录下面删除这个空文件既...
TEmailServer is a built-in SMTP server that can simultaneously validate or verify email addresses and send multiple email messages. As long as you have an internet connection, you can send emails from...
安装这是可通过使用的模块... user ) return next ( createError ( 401 , 'Please login to view this page.' ) ) next ( )} )原料药这是当前的API,当前是从Koa中提取的,并且可能会发生变化。错误属性expose -可以用