diff --git a/prometheusd.sh b/prometheusd.sh index 47712fc..91e11b1 100755 --- a/prometheusd.sh +++ b/prometheusd.sh @@ -2,11 +2,15 @@ set -e STATS=${STATS:-/tmp/stats.yaml} +pid=/tmp/prometheus.pid case $1 in start) - rm -f /tmp/prometheus.pid - daemonize -c /tmp -p /tmp/prometheus.pid -l /tmp/prometheus.pid -u knot /usr/bin/knot-prometheus-exporter ${STATS} + test -f $tmp && echo "prometheus-exporter already running" + daemonize -c /tmp -p $tmp -l $tmp -u knot /usr/bin/knot-prometheus-exporter ${STATS} + ;; + stop) + test -f $tmp && cat $tmp | xargs -r kill + rm -f $tmp ;; - stop) cat /tmp/prometheus.pid | xargs -r kill ;; esac