]> git.pld-linux.org Git - packages/collectd.git/blame - collectd.init
- fixed default path for types.db
[packages/collectd.git] / collectd.init
CommitLineData
db900f38 1#!/bin/sh
2#
3# collectd collectd (collectd daemon)
4#
5# chkconfig: 345 93 11
6#
8bf92105
ER
7# description: utility that colect various system information into rrd files
8#
9# $Id$
db900f38 10
11# Source function library
12. /etc/rc.d/init.d/functions
13
14# Get service config
15[ -f /etc/sysconfig/collectd ] && . /etc/sysconfig/collectd
16
8bf92105
ER
17# Get network config
18. /etc/sysconfig/network
db900f38 19
8bf92105
ER
20# Check that networking is up.
21if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down collectd
24 exit 1
25 fi
26else
27 exit 0
28fi
db900f38 29
393f7292
PG
30checkconfig() {
31 /usr/sbin/collectd -t || exit 1
32}
33
8bf92105 34start() {
db900f38 35 # Check if the service is already running?
36 if [ ! -f /var/lock/subsys/collectd ]; then
37 msg_starting collectd
38 daemon /usr/sbin/collectd
39 RETVAL=$?
40 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/collectd
41 else
42 msg_already_running collectd
43 fi
8bf92105
ER
44}
45
46stop() {
db900f38 47 if [ -f /var/lock/subsys/collectd ]; then
48 msg_stopping collectd
49 killproc collectd
50 rm -f /var/lock/subsys/collectd >/dev/null 2>&1
51 else
52 msg_not_running collectd
53 fi
8bf92105
ER
54}
55
56condrestart() {
57 if [ -f /var/lock/subsys/collectd ]; then
393f7292 58 checkconfig
8bf92105
ER
59 stop
60 start
61 else
62 msg_not_running collectd
63 RETVAL=$1
64 fi
65}
66
67RETVAL=0
68case "$1" in
69 start)
70 start
71 ;;
72 stop)
73 stop
db900f38 74 ;;
75 restart)
393f7292 76 checkconfig
8bf92105
ER
77 stop
78 start
79 ;;
80 try-restart)
81 condrestart 0
82 ;;
83 force-reload)
84 condrestart 7
db900f38 85 ;;
86 status)
393f7292 87 checkconfig
db900f38 88 status collectd
89 exit $?
90 ;;
91 *)
8bf92105 92 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
db900f38 93 exit 3
94esac
95
96exit $RETVAL
This page took 0.048278 seconds and 4 git commands to generate.