mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-14 02:36:06 -04:00
core detection and alerting fixes
This commit is contained in:
16
gbstart.sh
16
gbstart.sh
@ -23,15 +23,18 @@ function get_cpu_affinity() {
|
||||
function send_alert() {
|
||||
# if slacktee is present, send alert using Slack
|
||||
if [ -f "slacktee.sh" ] && [ -f "slacktee.conf" ]; then
|
||||
echo -e "`hostname`:`pwd`: $1\n\n" > lastcore.alert.txt
|
||||
# ls -tr log*|tail -1|xargs tail -30 >> lastcore.alert.txt
|
||||
# Send single-line alert to make sure it is received
|
||||
echo -e "`hostname`:`pwd`: $1" | ./slacktee.sh --config ./slacktee.conf
|
||||
|
||||
echo > lastcore.alert.txt
|
||||
ls -tr log*|tail -1|xargs tail -100 >> lastcore.alert.txt
|
||||
|
||||
# if core is there, send first 20 lines of backtrace
|
||||
if [ -f "core" ]; then
|
||||
gdb --batch --quiet -ex "bt full" -ex "quit" ./gb ./core | grep -v LWP | head -20 >> lastcore.alert.txt
|
||||
echo -e "\nStack trace:\n" >> lastcore.alert.txt
|
||||
gdb --batch --quiet -ex "bt" -ex "quit" ./gb ./core | grep -v LWP | head -20 >> lastcore.alert.txt
|
||||
fi
|
||||
|
||||
cat lastcore.alert.txt | ./slacktee.sh --config ./slacktee.conf
|
||||
cat lastcore.alert.txt | ./slacktee.sh --config ./slacktee.conf --plain-text
|
||||
fi
|
||||
}
|
||||
|
||||
@ -49,7 +52,8 @@ function backup_core() {
|
||||
|
||||
function backup_core_and_alert_if_found() {
|
||||
if [ -f "core" ]; then
|
||||
file core|grep ./gb
|
||||
# Use gdb to determine core creator. file was not reliable.
|
||||
gdb --batch --quiet -ex "bt" -ex "quit" ./gb ./core 2>/dev/null|grep -i "generated by"|grep ./gb
|
||||
EXITSTATUS=$?
|
||||
if [ $EXITSTATUS = 0 ]; then
|
||||
# core is ours
|
||||
|
Reference in New Issue
Block a user