| Server IP : 172.67.134.114 / Your IP : 162.159.115.41 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/sbin/ |
Upload File : |
#!/bin/bash
# Install coredump handler which saves segfault data
# For debugging
dry_run=false
verbose=false
PATTERN_FILE="/proc/sys/kernel/core_pattern"
SAVED_PATTERN_DIR="/var/run/abrt"
SAVED_PATTERN_FILE="/var/run/abrt/saved_core_pattern"
HOOK_BIN="/usr/libexec/abrt-hook-ccpp"
# Must match percent_specifiers[] order in abrt-hook-ccpp.c:
PATTERN="|$HOOK_BIN %s %c %p %u %g %t %P %I %h %e"
# core_pipe_limit specifies how many dump_helpers can run at the same time
# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
# process will be available for dump_helper.
# 4 - means that 4 dump_helpers can run at the same time (the rest will also
# run, but they will fail to read /proc/<pid>).
#
# This should be enough for ABRT, we can miss some crashes, but what are
# the odds that more processes crash at the same time? And moreover,
# do people want to save EVERY ONE of the crashes when they have
# a crash storm? I don't think so.
# The value of 4 has been recommended by nhorman.
#
CORE_PIPE_LIMIT_FILE="/proc/sys/kernel/core_pipe_limit"
CORE_PIPE_LIMIT="4"
start() {
if ! $HOOK_BIN --test-config; then
echo "Invalid configuration."
exit 1
fi
cur=`cat "$PATTERN_FILE"`
cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
$verbose && printf "cur:'%s'\n" "$cur"
# Is it already installed?
if test x"$cur_first" != x"|$HOOK_BIN"; then # no
# It is not installed
mkdir -p -- "$SAVED_PATTERN_DIR"
printf "%s\n" "$cur" >"$SAVED_PATTERN_FILE"
# Install new handler
$verbose && printf "Installing to %s:'%s'\n" "$PATTERN_FILE" "$PATTERN"
$dry_run || echo "$PATTERN" >"$PATTERN_FILE"
# Check core_pipe_limit and change it if it's 0,
# otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
# of the crashing process
if test x"`cat "$CORE_PIPE_LIMIT_FILE"`" = x"0"; then
echo "$CORE_PIPE_LIMIT" >"$CORE_PIPE_LIMIT_FILE"
fi
fi
}
stop() {
if test -f "$SAVED_PATTERN_FILE"; then
$verbose && printf "Restoring to %s:'%s'\n" "$PATTERN_FILE" "`cat "$SAVED_PATTERN_FILE"`"
$dry_run || cat "$SAVED_PATTERN_FILE" >"$PATTERN_FILE"
fi
}
status() {
cur=`cat "$PATTERN_FILE"`
cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
# Is it already installed?
if test x"$cur_first" = x"|$HOOK_BIN"; then # yes
$verbose && printf "Installed\n"
return 0
else
$verbose && printf "Not installed\n"
return 1
fi
}
case "$1" in
install)
start
;;
uninstall)
stop
;;
is-installed)
status
;;
*)
echo $"Usage: $0 {install|uninstall|is-installed}"
exit 2
esac