2018-05-18 16:38:19 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) <2018> Intel Corporation
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#
|
|
|
|
|
|
|
|
# modify the core_pattern
|
|
|
|
echo "|/usr/bin/usercrash_c %p %e %s" > /proc/sys/kernel/core_pattern
|
|
|
|
|
2018-06-05 13:42:56 +08:00
|
|
|
default_conf="/usr/share/defaults/telemetrics/telemetrics.conf"
|
|
|
|
user_conf="/etc/telemetrics/telemetrics.conf"
|
2018-05-18 16:38:19 +08:00
|
|
|
|
2018-06-05 13:42:56 +08:00
|
|
|
grep -q "record_server_delivery_enabled=false" $user_conf
|
2018-05-18 16:38:19 +08:00
|
|
|
if [ "$?" -eq "0" ];then
|
|
|
|
exit;
|
|
|
|
fi
|
|
|
|
|
|
|
|
telemd_services=(
|
|
|
|
hprobe.timer
|
|
|
|
telemd-update-trigger.service
|
|
|
|
pstore-clean.service
|
|
|
|
pstore-probe.service
|
|
|
|
oops-probe.service
|
|
|
|
klogscanner.service
|
|
|
|
journal-probe.service
|
|
|
|
bert-probe.service
|
|
|
|
)
|
|
|
|
|
2018-06-05 13:42:56 +08:00
|
|
|
mkdir -p $(dirname $user_conf)
|
|
|
|
cp $default_conf $user_conf
|
|
|
|
|
2018-05-18 16:38:19 +08:00
|
|
|
for ((i=0;i<${#telemd_services[*]};i++))
|
|
|
|
do
|
|
|
|
if [ ! -L "/etc/systemd/system/${telemd_services[$i]}" ];then
|
|
|
|
systemctl mask ${telemd_services[$i]} --now
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# modify the configure file
|
|
|
|
|
2018-06-05 13:42:56 +08:00
|
|
|
sed -i "s/server_delivery_enabled=true/server_delivery_enabled=false/g" $user_conf
|
|
|
|
sed -i "s/record_retention_enabled=false/record_retention_enabled=true/g" $user_conf
|
2018-05-18 16:38:19 +08:00
|
|
|
|
|
|
|
# restart telemd
|
|
|
|
sleep 3
|
|
|
|
systemctl restart telemd.service
|