Use deb-systemd-invoke to restart service (#3506)

From man page:
```
deb-systemd-invoke is a Debian-specific helper script which asks
       /usr/sbin/policy-rc.d before performing a systemctl call.

deb-systemd-invoke is intended to be used from maintscripts to start
       systemd unit files. It is specifically NOT intended to be used
       interactively by users. Instead, users should run systemd and use
       systemctl, or not bother about the systemd enabled state in case they
       are not running systemd.
```

This PR replace regular `systemctl` with `deb-systemd-invoke`.
This commit is contained in:
Lukasz Jagiello 2017-11-27 17:05:32 -08:00 committed by Daniel Nelson
parent 6514399baf
commit a18eedb970
1 changed files with 1 additions and 1 deletions

View File

@ -74,7 +74,7 @@ elif [[ -f /etc/debian_version ]]; then
# Debian/Ubuntu logic
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
install_systemd /lib/systemd/system/telegraf.service
systemctl restart telegraf || echo "WARNING: systemd not running."
deb-systemd-invoke restart telegraf.service || echo "WARNING: systemd not running."
else
# Assuming SysVinit
install_init