blob: 7e98a703dbb80054571ff4f4076d6fd8b5d362f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/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
|