mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-24 22:06:49 +01:00
8864a7bf0d
Fix the grammar of an error message. Signed-off-by: Roman Pertl <roman@pertl.org>
64 lines
984 B
Bash
Executable File
64 lines
984 B
Bash
Executable File
#!/bin/bash
|
|
|
|
RETVAL=0
|
|
PROG="node_exporter"
|
|
EXEC="/etc/node_exporter/node_exporter"
|
|
LOCKFILE="/var/lock/subsys/$PROG"
|
|
OPTIONS="--web.listen-address=:9100"
|
|
|
|
# Source function library.
|
|
if [ -f /etc/rc.d/init.d/functions ]; then
|
|
. /etc/rc.d/init.d/functions
|
|
else
|
|
echo "/etc/rc.d/init.d/functions does not exist"
|
|
exit 0
|
|
fi
|
|
|
|
start() {
|
|
if [ -f $LOCKFILE ]
|
|
then
|
|
echo "$PROG is already running!"
|
|
else
|
|
echo -n "Starting $PROG: "
|
|
nohup $EXEC $OPTIONS >/dev/null 2>&1 &
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failure
|
|
echo
|
|
return $RETVAL
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
echo -n "Stopping $PROG: "
|
|
killproc $EXEC
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failure
|
|
echo
|
|
}
|
|
|
|
restart ()
|
|
{
|
|
stop
|
|
sleep 1
|
|
start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status $PROG
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|status}"
|
|
exit 1
|
|
esac
|
|
exit $RETVAL
|