update backend debug script

This commit is contained in:
Alexander Zobnin
2020-01-29 15:35:10 +03:00
parent 5c9d9cd92e
commit e52698ea16

View File

@@ -7,10 +7,16 @@ fi
PORT="${2:-3222}" PORT="${2:-3222}"
PLUGIN_NAME="${1:-zabbix-plugin_}" PLUGIN_NAME="${1:-zabbix-plugin_}"
ptrace_scope=`cat /proc/sys/kernel/yama/ptrace_scope` if [ "$OSTYPE" == "linux-gnu" ]; then
if [ "$ptrace_scope" != 0 ]; then ptrace_scope=`cat /proc/sys/kernel/yama/ptrace_scope`
echo "WARNING: ptrace_scope set to value other than 0, this might prevent debugger from connecting, try writing \"0\" to /proc/sys/kernel/yama/ptrace_scope. if [ "$ptrace_scope" != 0 ]; then
echo "WARNING: ptrace_scope set to value other than 0, this might prevent debugger from connecting, try writing \"0\" to /proc/sys/kernel/yama/ptrace_scope.
Read more at https://www.kernel.org/doc/Documentation/security/Yama.txt" Read more at https://www.kernel.org/doc/Documentation/security/Yama.txt"
read -p "Set ptrace_scope to 0? y/N (default N)" set_ptrace_input
if [ "$set_ptrace_input" == "y" ] || [ "$set_ptrace_input" == "Y" ]; then
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
fi
fi
fi fi
PLUGIN_PID=`pgrep ${PLUGIN_NAME}` PLUGIN_PID=`pgrep ${PLUGIN_NAME}`