| 1 | #!/bin/sh |
| 2 | EXEFILE=`which prometheus` |
| 3 | DEFAULT=/etc/default/prometheus |
| 4 | |
| 5 | if [ -e $DEFAULT ]; then |
| 6 | . $DEFAULT |
| 7 | |
| 8 | case "$PROMETHEUS_ENABLE" in |
| 9 | [Nn]*) |
| 10 | echo "Prometheus disabled in /etc/default/prometheus !" |
| 11 | exit 0 |
| 12 | ;; |
| 13 | esac |
| 14 | |
| 15 | else |
| 16 | echo "File /etc/default/prometheus not found !" |
| 17 | exit 0 |
| 18 | fi |
| 19 | |
| 20 | case "$1" in |
| 21 | start) |
| 22 | $EXEFILE -n |
| 23 | ;; |
| 24 | stop) |
| 25 | $EXEFILE -f |
| 26 | ;; |
| 27 | kill) |
| 28 | $EXEFILE -9 |
| 29 | ;; |
| 30 | restart|force-reload) |
| 31 | $0 stop |
| 32 | sleep 1 |
| 33 | $0 start |
| 34 | ;; |
| 35 | *) |
| 36 | echo "Usage: $0 {start|stop|restart|force-reload|kill}" >&2 |
| 37 | exit 1 |
| 38 | ;; |
| 39 | esac |