]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/collectd
Load libata prior udev at installer because some SATA doesnt autoload it
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / collectd
1 #!/bin/sh
2 # Begin $rc_base/init.d/collecd
3
4
5 . /etc/sysconfig/rc
6 . $rc_functions
7
8 case "$1" in
9 start)
10 if [ ! -e /etc/sysconfig/lm_sensors ]; then
11 boot_mesg "Searching for Sensors..."
12 "yes" | /usr/sbin/sensors-detect > /dev/null
13 evaluate_retval
14 if [ ! -e /etc/sysconfig/lm_sensors ]; then
15 echo "#No Sensors detected " > /etc/sysconfig/lm_sensors
16 fi
17 fi
18
19 boot_mesg -n "Loading Sensor Modules..."
20 for modul in `cat /etc/sysconfig/lm_sensors | grep '^MODULE_' | cut -d"=" -s -f2`; do
21 modprobe $modul > /dev/null 2>&1;
22 if [ ${?} = 0 ]; then
23 boot_mesg -n "$SUCCESS$modul$NORMAL ";
24 else
25 boot_mesg -n "$FAILURE$modul$NORMAL ";
26 fi
27 done
28 boot_mesg;
29 echo_ok;
30
31 boot_mesg "Starting Collection daemon..."
32 /usr/sbin/collectd -C /etc/collectd.conf
33 evaluate_retval
34 #
35 # These lines are for furhter implementation of the collectd, atm the temps are
36 # collected by the makegraphs script because of the standby functions
37 #
38 # for disk in `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`; do boot_mesg "Bringing up hddtemp daemon for $disk ..."; /usr/sbin/hddtemp $disk -d -l localhost; evaluate_retval; done
39 #
40 # Starting the mbmon in deamon mode to enable sensors reading for collectd
41 # later mbmon will be replaced by lmsensors, if mbmon is not running on your
42 # system, we advise to comment out these lines in order to prevent fail
43 #
44 # boot_mesg "Bringing up mbmon daemon..."
45 # /usr/bin/mbmon -P 411 -r
46 # evaluate_retval
47 ;;
48
49 stop)
50 # if mbmon is not running on your system, we advise to comment out these lines
51 # in order to prevent fail
52 # boot_mesg "Stopping mbmon daemon..."
53 # killproc /usr/bin/mbmon
54 # evaluate_retval
55 # boot_mesg "Stopping hddtemp daemon..."
56 # killproc /usr/sbin/hddtemp
57 # evaluate_retval
58 boot_mesg "Stopping Collection daemon..."
59 killproc /usr/sbin/collectd
60 evaluate_retval
61 ;;
62
63 restart)
64
65 #
66 # We need to do this that way because mbmon doesn`t clear the port when killed
67 # so the next startup it fails with port allready in use -> donĀ“t restart mbmon
68 #
69 boot_mesg "Stopping Collection daemon..."
70 killproc /usr/sbin/collectd
71 evaluate_retval
72 sleep 1
73 boot_mesg "Starting Collection daemon..."
74 /usr/sbin/collectd -C /etc/collectd.conf
75 evaluate_retval
76 ;;
77
78 status)
79 statusproc /usr/sbin/collectd
80 ;;
81
82 *)
83 echo "Usage: $0 {start|stop|restart|status}"
84 exit 1
85 ;;
86 esac
87
88 # End $rc_base/init.d/collectd