修改rpm打包文件,增加初始化sysctl配置

This commit is contained in:
linxin
2023-05-05 10:47:12 +08:00
parent bd8134ad8a
commit 4271e7eaeb
3 changed files with 29 additions and 3 deletions

23
60-coredump.conf Normal file
View File

@@ -0,0 +1,23 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See sysctl.d(5) for the description of the files in this directory,
# and systemd-coredump(8) and core(5) for the explanation of the
# setting below.
kernel.core_pattern=|/opt/tsg/coredump/bin/coredump-handler -P %P -E %E -t %t -p %p -g %g -s %s -u %u -C /opt/tsg/coredump/etc/config.json
# Allow that 16 coredumps are dispatched in parallel by the kernel. We want to
# be able to collect process metadata from /proc/%P/ while processing
# coredumps, and thus need to make sure the crashed processes are not reaped
# until we finished collecting what we need. The kernel default for this sysctl
# is "0" which means the kernel doesn't wait for userspace processes to finish
# processing before reaping the crashed processes — by setting this higher the
# kernel will delay reaping until we are done, but only for the specified
# number of crashes in parallel. The value of 16 is chosen to match
# systemd-coredump.socket's MaxConnections= value.
kernel.core_pipe_limit=16

View File

@@ -1,7 +1,7 @@
package main
import (
"coredump-handler/types"
"coredump-tools/types"
"fmt"
"net"
"os/exec"

View File

@@ -21,7 +21,7 @@ This package contains the binary executable for coredump-handler and coredump-to
cd ./coredump-handler
go build -o coredump-handler .
cd ..
cd ./coredump-ctl
cd ./coredump-tool
go build -o coredump-tool .
cd ..
%install
@@ -30,11 +30,13 @@ mkdir -p %{buildroot}/opt/tsg/coredump/bin
mkdir -p %{buildroot}/opt/tsg/coredump/etc
mkdir -p %{buildroot}/etc/profile.d
mkdir -p %{buildroot}/usr/lib/tmpfiles.d
mkdir -p %{buildroot}/usr/lib/sysctl.d
cp ./coredump-handler/coredump-handler %{buildroot}/opt/tsg/coredump/bin
cp ./config/config.json %{buildroot}/opt/tsg/coredump/etc
cp ./coredump-ctl/coredump-tool %{buildroot}/opt/tsg/coredump/bin
cp ./coredump-tool/coredump-tool %{buildroot}/opt/tsg/coredump/bin
cp ./script/coredump-tools.sh %{buildroot}/etc/profile.d
cp ./coredump.conf %{buildroot}/usr/lib/tmpfiles.d
cp ./60-coredump.conf %{buildroot}/usr/lib/sysctl.d
%files
%defattr (-,root,root)
/opt/tsg/coredump/etc/config.json
@@ -42,3 +44,4 @@ cp ./coredump.conf %{buildroot}/usr/lib/tmpfiles.d
/opt/tsg/coredump/bin/coredump-tool
/etc/profile.d/coredump-tools.sh
/usr/lib/tmpfiles.d/coredump.conf
/usr/lib/sysctl.d/60-coredump.conf