diff --git a/type/__prometheus_yoctotemp_exporter/gencode-remote b/type/__prometheus_yoctotemp_exporter/gencode-remote index 6c179c8..adb94e5 100755 --- a/type/__prometheus_yoctotemp_exporter/gencode-remote +++ b/type/__prometheus_yoctotemp_exporter/gencode-remote @@ -4,17 +4,19 @@ VCS_TAG=$(cat "$__object/parameter/version") VCS_URL="https://code.recycled.cloud/RecycledCloud/prometheus-yoctotemp-exporter/raw/tag/$VCS_TAG/prometheus-yoctotemp-exporter" cat << EOF -cd /opt/prometheus-yoctotemp-exporter - -# Fetch sources. -curl "$VCS_URL" -o prometheus-yoctotemp-exporter - -# Install virtualenv and dependencies. -virtualenv -p python3 venv -. venv/bin/activate -pip install prometheus_client -pip install yoctopuce - -# Start service -service prometheus-yoctotemp-exporter start +if [ ! -d /opt/prometheus-yoctotemp-exporter ]; then + cd /opt/prometheus-yoctotemp-exporter + + # Fetch sources. + curl "$VCS_URL" -o prometheus-yoctotemp-exporter + + # Install virtualenv and dependencies. + virtualenv -p python3 venv + . venv/bin/activate + pip install prometheus_client + pip install yoctopuce + + # Start service + service prometheus-yoctotemp-exporter start +fi EOF