From c23f0321f09af79bcd340482277dd4724883341b Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 22 Feb 2020 15:54:42 +0900 Subject: [PATCH] Modify collectd installer to use either bisq or bisq-pricenode services --- monitor/install_collectd_debian.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/monitor/install_collectd_debian.sh b/monitor/install_collectd_debian.sh index 91f1ad8d1b3..e815616d076 100755 --- a/monitor/install_collectd_debian.sh +++ b/monitor/install_collectd_debian.sh @@ -29,8 +29,10 @@ sudo -H -i -u "${ROOT_USER}" DEBIAN_FRONTEND=noninteractive apt-get install -qq echo "[*] Preparing Bisq init script for monitoring" # remove stuff it it is there already -sudo -H -i -u "${ROOT_USER}" sed -i -e 's/-Dcom.sun.management.jmxremote //g' -e 's/-Dcom.sun.management.jmxremote.local.only=true//g' -e 's/ -Dcom.sun.management.jmxremote.host=127.0.0.1//g' -e 's/ -Dcom.sun.management.jmxremote.port=6969//g' -e 's/ -Dcom.sun.management.jmxremote.rmi.port=6969//g' -e 's/ -Dcom.sun.management.jmxremote.ssl=false//g' -e 's/ -Dcom.sun.management.jmxremote.authenticate=false//g' "${SYSTEMD_ENV_HOME}/bisq.env" -sudo -H -i -u "${ROOT_USER}" sed -i -e '/JAVA_OPTS/ s/"$/ -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=true -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.rmi.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"/' "${SYSTEMD_ENV_HOME}/bisq.env" +if [ -f "${SYSTEMD_ENV_HOME}/bisq.env" ];then + sudo -H -i -u "${ROOT_USER}" sed -i -e 's/-Dcom.sun.management.jmxremote //g' -e 's/-Dcom.sun.management.jmxremote.local.only=true//g' -e 's/ -Dcom.sun.management.jmxremote.host=127.0.0.1//g' -e 's/ -Dcom.sun.management.jmxremote.port=6969//g' -e 's/ -Dcom.sun.management.jmxremote.rmi.port=6969//g' -e 's/ -Dcom.sun.management.jmxremote.ssl=false//g' -e 's/ -Dcom.sun.management.jmxremote.authenticate=false//g' "${SYSTEMD_ENV_HOME}/bisq.env" + sudo -H -i -u "${ROOT_USER}" sed -i -e '/JAVA_OPTS/ s/"$/ -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=true -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.rmi.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"/' "${SYSTEMD_ENV_HOME}/bisq.env" +fi echo "[*] Seeding entropy from /dev/urandom" sudo -H -i -u "${ROOT_USER}" /bin/sh -c "head -1500 /dev/urandom > ${ROOT_HOME}/.rnd" @@ -50,7 +52,11 @@ sudo -H -i -u "${ROOT_USER}" systemctl enable nginx.service sudo -H -i -u "${ROOT_USER}" systemctl enable collectd.service echo "[*] Restarting services" -sudo -H -i -u "${ROOT_USER}" systemctl restart bisq.service +set +e +service bisq status >/dev/null 2>&1 +[ $? != 4 ] && sudo -H -i -u "${ROOT_USER}" systemctl restart bisq.service +service bisq-pricenode status >/dev/null 2>&1 +[ $? != 4 ] && sudo -H -i -u "${ROOT_USER}" systemctl restart bisq-pricenode.service sudo -H -i -u "${ROOT_USER}" systemctl restart nginx.service sudo -H -i -u "${ROOT_USER}" systemctl restart collectd.service