[TD-2467]
This commit is contained in:
parent
5771d26b89
commit
26b342ff13
|
@ -2,19 +2,39 @@
|
||||||
#
|
#
|
||||||
# This file is used to set config for core when taosd crash
|
# This file is used to set config for core when taosd crash
|
||||||
|
|
||||||
|
# Color setting
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[1;32m'
|
||||||
|
GREEN_DARK='\033[0;32m'
|
||||||
|
GREEN_UNDERLINE='\033[4;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
# set -x
|
# set -x
|
||||||
|
corePath=$1
|
||||||
|
|
||||||
csudo=""
|
csudo=""
|
||||||
if command -v sudo > /dev/null; then
|
if command -v sudo > /dev/null; then
|
||||||
csudo="sudo"
|
csudo="sudo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#ulimit -c unlimited
|
if [[ ! -n ${corePath} ]]; then
|
||||||
|
echo -e -n "${GREEN}Please enter a file directory to save the coredump file${NC}:"
|
||||||
|
read corePath
|
||||||
|
while true; do
|
||||||
|
if [[ ! -z "$corePath" ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
read -p "Please enter a file directory to save the coredump file:" corePath
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
ulimit -c unlimited
|
||||||
${csudo} sed -i '/ulimit -c unlimited/d' /etc/profile ||:
|
${csudo} sed -i '/ulimit -c unlimited/d' /etc/profile ||:
|
||||||
${csudo} sed -i '$a\ulimit -c unlimited' /etc/profile ||:
|
${csudo} sed -i '$a\ulimit -c unlimited' /etc/profile ||:
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
|
|
||||||
${csudo} mkdir -p /coredump ||:
|
${csudo} mkdir -p ${corePath} ||:
|
||||||
${csudo} sysctl -w kernel.core_pattern='/coredump/core-%e-%p' ||:
|
${csudo} sysctl -w kernel.core_pattern=${corePath}/core-%e-%p ||:
|
||||||
${csudo} echo '/coredump/core-%e-%p' | ${csudo} tee /proc/sys/kernel/core_pattern ||:
|
${csudo} echo "${corePath}/core-%e-%p" | ${csudo} tee /proc/sys/kernel/core_pattern ||:
|
||||||
|
|
Loading…
Reference in New Issue