scripts: systemd - Kill also telegraf MAINPID child (stop,restart,reload)

killall binary is included in the package psmisc.
we maybe have another way to solve this issue with « standard » tools
https://stackoverflow.com/questions/392022/best-way-to-kill-all-child-processes

Refs: #1576
This commit is contained in:
Sebastien Badia 2016-08-03 16:52:57 +02:00
parent 30dbfd9af8
commit ccf20cdad9
No known key found for this signature in database
GPG Key ID: 8716CE4614A452D8
2 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@
- [#1430](https://github.com/influxdata/telegraf/issues/1430): Fix prometheus character sanitizing. Sanitize more win_perf_counters characters. - [#1430](https://github.com/influxdata/telegraf/issues/1430): Fix prometheus character sanitizing. Sanitize more win_perf_counters characters.
- [#1534](https://github.com/influxdata/telegraf/pull/1534): Add diskio io_time to FreeBSD & report timing metrics as ms (as linux does). - [#1534](https://github.com/influxdata/telegraf/pull/1534): Add diskio io_time to FreeBSD & report timing metrics as ms (as linux does).
- [#1379](https://github.com/influxdata/telegraf/issues/1379): Fix covering Amazon Linux for post remove flow. - [#1379](https://github.com/influxdata/telegraf/issues/1379): Fix covering Amazon Linux for post remove flow.
- [#1576](https://github.com/influxdata/telegraf/issues/1576): Fix systemd unit (kill also telegraf child process).
## v1.0 beta 3 [2016-07-18] ## v1.0 beta 3 [2016-07-18]

View File

@ -9,7 +9,8 @@ User=telegraf
Environment='STDOUT=/var/log/telegraf/telegraf.log' Environment='STDOUT=/var/log/telegraf/telegraf.log'
Environment='STDERR=/var/log/telegraf/telegraf.log' Environment='STDERR=/var/log/telegraf/telegraf.log'
ExecStart=/bin/sh -c "exec /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d ${TELEGRAF_OPTS} >>${STDOUT} 2>>${STDERR}" ExecStart=/bin/sh -c "exec /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d ${TELEGRAF_OPTS} >>${STDOUT} 2>>${STDERR}"
ExecReload=/bin/kill -HUP $MAINPID ExecStop=/usr/bin/killall telegraf
ExecReload=/usr/bin/killall telegraf
Restart=on-failure Restart=on-failure
KillMode=control-group KillMode=control-group