Skip to content

Commit

Permalink
Add reload configuration for telegraf service scripts.
Browse files Browse the repository at this point in the history
closes #794
  • Loading branch information
entertainyou authored and sparrc committed Mar 16, 2016
1 parent c2bb9db commit f8e9faf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ case $1 in
fi
;;

reload)
# Reload the daemon.
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
if [ "$status" = 0 ]; then
if killproc -p $pidfile SIGHUP; then
log_success_msg "$name process was reloaded"
else
log_failure_msg "$name failed to reload service"
fi
fi
else
log_failure_msg "$name process is not running"
fi
;;

restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
Expand Down
1 change: 1 addition & 0 deletions scripts/telegraf.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ After=network.target
EnvironmentFile=-/etc/default/telegraf
User=telegraf
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d ${TELEGRAF_OPTS}
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
KillMode=process

Expand Down

0 comments on commit f8e9faf

Please sign in to comment.