mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-04 20:29:09 +01:00
7bc511d82a
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
45 lines
653 B
Bash
45 lines
653 B
Bash
#!/bin/sh
|
|
|
|
DAEMON="netdata"
|
|
DAEMON_PATH=/usr/sbin
|
|
PIDFILE=/var/run/$DAEMON.pid
|
|
DAEMONOPTS="-P $PIDFILE"
|
|
LOCKFILE=/var/lock/subsys/$DAEMON
|
|
|
|
service_start()
|
|
{
|
|
[ -x $DAEMON_PATH ] || exit 5
|
|
echo "Starting $DAEMON..."
|
|
if [ -e "$LOCKFILE" ]; then
|
|
echo "netdata server already running!"
|
|
echo "Please remove $LOCKFILE"
|
|
else
|
|
$DAEMON_PATH/$DAEMON $DAEMONOPTS &
|
|
touch $LOCKFILE
|
|
fi
|
|
}
|
|
|
|
service_stop()
|
|
{
|
|
echo "Stopping $DAEMON..."
|
|
killall $DAEMON > /dev/null 2>&1
|
|
rm -f $LOCKFILE
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
start)
|
|
service_start
|
|
;;
|
|
stop)
|
|
service_stop
|
|
;;
|
|
restart)
|
|
service_stop
|
|
sleep 2
|
|
service_start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|