Created
February 6, 2015 14:43
sysvinit prometheus init script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: prometheus | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Should-Start: | |
# Should-Stop: | |
# Default-Start: S | |
# Default-Stop: | |
# Short-Description: Run Prometheus server | |
### END INIT INFO | |
. /lib/lsb/init-functions | |
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin" | |
NAME="prometheus" | |
DESC="Prometheus time series database" | |
if [ -r "/etc/default/${NAME}" ] | |
then | |
. "/etc/default/${NAME}" | |
fi | |
set -e | |
case "${1}" in | |
start) | |
log_daemon_msg "Starting Prometheus" $NAME | |
start-stop-daemon --pidfile /var/run/$NAME.pid --make-pidfile \ | |
--background --exec /usr/bin/writelog --start -- \ | |
/var/log/$NAME.log /usr/local/bin/$NAME -config.file /etc/prometheus.conf $DAEMON_OPTS | |
log_end_msg 0 | |
;; | |
stop) | |
log_daemon_msg "Stopping Prometheus" "$DAEMON" | |
start-stop-daemon --oknodo --pidfile /var/run/$NAME.pid --stop --retry 10 | |
log_end_msg 0 | |
;; | |
restart|force-reload) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: ${0} {start|stop|restart}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment