File: monitorix.init

package info (click to toggle)
monitorix 3.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,032 kB
  • sloc: perl: 57,203; makefile: 220; sh: 183
file content (93 lines) | stat: -rwxr-xr-x 1,834 bytes parent folder | download | duplicates (4)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
#
#	/etc/rc.d/init.d/monitorix
#
# Starts the Monitorix daemon
#
# chkconfig: 2345 99 10
# description: Monitorix is a lightweight system monitoring tool
# processname: monitorix
# config: /etc/monitorix/monitorix.conf
# pidfile: /var/run/monitorix.pid

### BEGIN INIT INFO
# Provides:          monitorix
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start up the Monitorix daemon
# Description:       Monitorix is a free, open source, lightweight system
#                    monitoring tool designed to monitor as many services and
#                    system resources as possible.
### END INIT INFO

# Source function library
. /etc/init.d/functions

if [ -f /etc/sysconfig/monitorix -a $UID -eq 0 ]; then
	. /etc/sysconfig/monitorix
fi

RETVAL=0
PROG="monitorix"
DAEMON="/usr/bin/monitorix"
PIDFILE="/var/run/monitorix.pid"
CONF="/etc/monitorix/monitorix.conf"

start() {
	if [ ! -f /var/lock/subsys/$PROG ] ; then
		echo -n $"Starting $PROG: "
		daemon $DAEMON -c $CONF -p $PIDFILE $OPTIONS && success || failure
		RETVAL=$?
		if [ $RETVAL -eq 0 ] ; then
			touch /var/lock/subsys/$PROG
			echo
		fi
	fi
}

stop() {
	echo -n $"Stopping $PROG: "
	killproc $PROG
	RETVAL=$?
	rm -f /var/lock/subsys/$PROG
	rm -f $PIDFILE
	echo
}

restart() {
	stop
	start
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	condrestart)
		if [ -f /var/lock/subsys/$PROG ] ; then
			restart
		fi
		;;
	status)
                if [ -f /var/lock/subsys/$PROG ] ; then
                  status $PROG
                  exit 0
                else
                  status $PROG
                  exit 1
                fi
		;;
	*)
		echo $"Usage: $0 {start|stop|restart|condrestart|status}"
		exit 1
esac

exit $RETVAL