Fixes #186 (install and init script for el5)

This commit is contained in:
Eugene Dementiev 2015-09-16 18:31:48 +03:00
parent d979ee5573
commit 2841c02809
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,8 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# chkconfig: 2345 99 01
# description: Telegraf daemon
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: telegraf # Provides: telegraf
# Required-Start: $all # Required-Start: $all

View File

@ -160,7 +160,14 @@ rm -f $INSTALL_ROOT_DIR/init.sh
ln -sfn $INSTALL_ROOT_DIR/versions/$version/telegraf $INSTALL_ROOT_DIR/telegraf ln -sfn $INSTALL_ROOT_DIR/versions/$version/telegraf $INSTALL_ROOT_DIR/telegraf
if ! id telegraf >/dev/null 2>&1; then 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 useradd --system -U -M telegraf
else
groupadd telegraf && useradd -M -g telegraf telegraf
fi
fi fi
# Systemd # Systemd