refactor code into collectd.js

This commit is contained in:
Girish Ramakrishnan
2020-01-31 13:33:19 -08:00
parent dece7319cc
commit 1981493398
3 changed files with 54 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
fi
cmd="$1"
appid="$2"
metric="$2" # note that this can also be 'cloudron-backup' or appid
if [[ "${BOX_ENV}" == "cloudron" ]]; then
# when restoring the cloudron with many apps, the apptasks rush in to restart
@@ -30,10 +30,10 @@ if [[ "${BOX_ENV}" == "cloudron" ]]; then
# delete old stats when uninstalling an app
if [[ "${cmd}" == "remove" ]]; then
echo "Removing collectd stats of ${appid}"
echo "Removing collectd stats of ${metric}"
for i in {1..10}; do
if rm -rf ${HOME}/platformdata/graphite/whisper/collectd/localhost/*${appid}*; then
if rm -rf ${HOME}/platformdata/graphite/whisper/collectd/localhost/*${metric}*; then
break
fi
echo "Failed to remove collectd directory. collectd possibly generated data in the middle of removal"