Add reload configuration for telegraf service scripts.
This commit is contained in:
parent
b4b1866286
commit
f15856d542
|
@ -159,6 +159,22 @@ case $1 in
|
||||||
fi
|
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)
|
||||||
# Restart the daemon.
|
# Restart the daemon.
|
||||||
$0 stop && sleep 2 && $0 start
|
$0 stop && sleep 2 && $0 start
|
||||||
|
|
|
@ -7,6 +7,7 @@ After=network.target
|
||||||
EnvironmentFile=-/etc/default/telegraf
|
EnvironmentFile=-/etc/default/telegraf
|
||||||
User=telegraf
|
User=telegraf
|
||||||
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d ${TELEGRAF_OPTS}
|
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
|
Restart=on-failure
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue