Skip to content

Instantly share code, notes, and snippets.

@inklit
Created January 29, 2018 06:18
Show Gist options
  • Save inklit/1cfefc40e802d18851339bb50f67a5a6 to your computer and use it in GitHub Desktop.
Save inklit/1cfefc40e802d18851339bb50f67a5a6 to your computer and use it in GitHub Desktop.
#!/sbin/openrc-run
description="node_exporter"
: ${NODE_PIDFILE:=/var/run/node_exporter.pid}
: ${NODE_USER:=root}
depend() {
need net
need localmount
use dns
after firewall
}
start() {
ebegin "Starting node_exporter"
start-stop-daemon --wait 1000 --background --start --exec \
/usr/sbin/node_exporter \
--user ${NODE_USER} \
--make-pidfile --pidfile ${NODE_PIDFILE} \
-- && \
chown ${NODE_USER}:root ${NODE_PIDFILE}
eend $?
}
stop() {
ebegin "Stopping node_exporter"
start-stop-daemon --wait 5000 --stop --exec \
/usr/sbin/node_exporter \
--user ${NODE_USER} \
--pidfile ${NODE_PIDFILE} \
-s SIGQUIT
eend $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment