From 406e980faef74065361220943025e8ea2d2b07b7 Mon Sep 17 00:00:00 2001 From: Eugene Dementiev Date: Wed, 16 Sep 2015 18:31:48 +0300 Subject: [PATCH] install and init script for el5 Fixes #186 Closes #203 --- scripts/init.sh | 3 +++ scripts/package.sh | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/scripts/init.sh b/scripts/init.sh index b9339e407..d65639674 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,5 +1,8 @@ #! /usr/bin/env bash +# chkconfig: 2345 99 01 +# description: Telegraf daemon + ### BEGIN INIT INFO # Provides: telegraf # Required-Start: $all diff --git a/scripts/package.sh b/scripts/package.sh index 7f5196e33..6ca5b0dca 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -160,7 +160,14 @@ rm -f $INSTALL_ROOT_DIR/init.sh ln -sfn $INSTALL_ROOT_DIR/versions/$version/telegraf $INSTALL_ROOT_DIR/telegraf if ! id telegraf >/dev/null 2>&1; then + useradd --help 2>&1| grep -- --system > /dev/null 2>&1 + old_useradd=\$? + if [[ \$old_useradd == 0 ]] + then useradd --system -U -M telegraf + else + groupadd telegraf && useradd -M -g telegraf telegraf + fi fi # Systemd