| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com> |
| 4 | # |
| 5 | # SPDX-License-Identifier: GPL-2.0-only |
| 6 | # |
| 7 | |
| 8 | CORE_PATTERN_PATH="/proc/sys/kernel/core_pattern" |
| 9 | CORE_HANDLER_PATH="$(dirname $(readlink -e $0))/handler.sh" |
| 10 | CORE_PATTERN="$(cat ${CORE_PATTERN_PATH})" |
| 11 | |
| 12 | echo ${CORE_PATTERN} > core_pattern.bkp |
| 13 | |
| 14 | echo "Backup current core_pattern in core_pattern.bkp." |
| 15 | |
| 16 | echo "|$CORE_HANDLER_PATH %p %u %g %s %t %h %e %E %c" > ${CORE_PATTERN_PATH} |
| 17 | |
| 18 | if [ $? -eq 0 ] |
| 19 | then |
| 20 | echo "Successfully installed core_pattern." |
| 21 | else |
| 22 | echo "Installation of core_pattern failed." |
| 23 | exit 1 |
| 24 | fi |