From 3bb1efc156b1b9916dd2a36f838f1f42927d41c5 Mon Sep 17 00:00:00 2001 From: Steven Soroka Date: Tue, 28 Jul 2020 11:26:09 -0400 Subject: [PATCH] fixes issue with rpm /var/log/telegraf permissions (#7909) --- scripts/rpm/post-install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/rpm/post-install.sh b/scripts/rpm/post-install.sh index eba82c9fb99fe..2bdb577be1009 100644 --- a/scripts/rpm/post-install.sh +++ b/scripts/rpm/post-install.sh @@ -43,6 +43,15 @@ if [[ ! -d /etc/telegraf/telegraf.d ]]; then mkdir -p /etc/telegraf/telegraf.d fi +# If 'telegraf.conf' is not present use package's sample (fresh install) +if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then + cp /etc/telegraf/telegraf.conf.sample /etc/telegraf/telegraf.conf +fi + +test -d $LOG_DIR || mkdir -p $LOG_DIR +chown -R -L telegraf:telegraf $LOG_DIR +chmod 755 $LOG_DIR + # Distribution-specific logic if [[ -f /etc/redhat-release ]] || [[ -f /etc/SuSE-release ]]; then # RHEL-variant logic