From a54466f8c2b6f19de9c7b060f87670b4d50453d3 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 10 May 2016 09:51:04 -0700 Subject: [PATCH] Fix apptask error because of multiple collectd restarts Everyone gets in a rush to restart collectd and apptask update/restore fails during infra updates --- src/scripts/reloadcollectd.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scripts/reloadcollectd.sh b/src/scripts/reloadcollectd.sh index ae0b5e63f..0156eff76 100755 --- a/src/scripts/reloadcollectd.sh +++ b/src/scripts/reloadcollectd.sh @@ -13,6 +13,17 @@ if [[ $# == 1 && "$1" == "--check" ]]; then fi if [[ "${BOX_ENV}" == "cloudron" ]]; then - /etc/init.d/collectd restart + for i in {1..10}; do + if systemctl is-active collectd.service; then + systemctl restart collectd + exit 0 + fi + + echo "Collectd is not active. Maybe some other apptask is restarting it" + sleep 6 + done + + echo "collectd not running" + exit 1 fi