Skip to content

Commit

Permalink
Create telegraf user in pre-install rpm scriptlet (influxdata#5783)
Browse files Browse the repository at this point in the history
  • Loading branch information
affo authored and bitcharmer committed Oct 18, 2019
1 parent 0916f11 commit 4a726a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 0 additions & 8 deletions scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions scripts/pre-install.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4a726a2

Please sign in to comment.