Create telegraf user in pre-install rpm scriptlet (#5783)

This commit is contained in:
Lorenzo Affetti 2019-04-30 20:04:45 +02:00 committed by Daniel Nelson
parent 76660e22a9
commit 2c3c377334
2 changed files with 8 additions and 8 deletions

View File

@ -24,14 +24,6 @@ function install_chkconfig {
chkconfig --add telegraf
}
if ! grep "^telegraf:" /etc/group &>/dev/null; then
groupadd -r telegraf
fi
if ! id telegraf &>/dev/null; then
useradd -r -M telegraf -s /bin/false -d /etc/telegraf -g telegraf
fi
# Remove legacy symlink, if it exists
if [[ -L /etc/init.d/telegraf ]]; then
rm -f /etc/init.d/telegraf

View File

@ -1,5 +1,13 @@
#!/bin/bash
if ! grep "^telegraf:" /etc/group &>/dev/null; then
groupadd -r telegraf
fi
if ! id telegraf &>/dev/null; then
useradd -r -M telegraf -s /bin/false -d /etc/telegraf -g telegraf
fi
if [[ -d /etc/opt/telegraf ]]; then
# Legacy configuration found
if [[ ! -d /etc/telegraf ]]; then