graphite: restart collectd as well

This commit is contained in:
Girish Ramakrishnan
2021-03-23 11:01:14 -07:00
parent 32f385741a
commit 0447dce0d6
9 changed files with 61 additions and 74 deletions

37
src/scripts/restartservice.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
set -eu -o pipefail
if [[ ${EUID} -ne 0 ]]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
if [[ $# -eq 0 ]]; then
echo "No arguments supplied"
exit 1
fi
if [[ "$1" == "--check" ]]; then
echo "OK"
exit 0
fi
[[ "${BOX_ENV}" != "cloudron" ]] && exit
service="$1"
if [[ "${service}" == "unbound" ]]; then
unbound-anchor -a /var/lib/unbound/root.key
systemctl restart unbound
elif [[ "${service}" == "nginx" ]]; then
nginx -s reload
elif [[ "${service}" == "docker" ]]; then
systemctl restart docker
elif [[ "${service}" == "collectd" ]]; then
systemctl restart collectd
else
echo "Unknown service ${service}"
exit 1
fi