install and init script for el5

Fixes #186
Closes #203
This commit is contained in:
Eugene Dementiev 2015-09-16 18:31:48 +03:00 committed by Cameron Sparr
parent 211065565f
commit 406e980fae
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,8 @@
#! /usr/bin/env bash
# chkconfig: 2345 99 01
# description: Telegraf daemon
### BEGIN INIT INFO
# Provides: telegraf
# 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
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