]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/collectd
Load sensor modules in collectd initskript
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / collectd
CommitLineData
a332b303
CS
1#!/bin/sh
2# Begin $rc_base/init.d/collecd
3
4
5. /etc/sysconfig/rc
6. $rc_functions
7
8case "$1" in
9 start)
a3f2742f
AF
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"=" -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
a332b303
CS
31 boot_mesg "Starting Collection daemon..."
32 /usr/sbin/collectd -C /etc/collectd.conf
33 evaluate_retval
9f663e66
CS
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#
a332b303 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
9f663e66
CS
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#
7bf4d18c
AF
44# boot_mesg "Bringing up mbmon daemon..."
45# /usr/bin/mbmon -P 411 -r
46# evaluate_retval
a332b303
CS
47 ;;
48
49 stop)
9f663e66
CS
50# if mbmon is not running on your system, we advise to comment out these lines
51# in order to prevent fail
a3f2742f
AF
52# boot_mesg "Stopping mbmon daemon..."
53# killproc /usr/bin/mbmon
54# evaluate_retval
a332b303
CS
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)
9f663e66
CS
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
a332b303 72 sleep 1
9f663e66
CS
73 boot_mesg "Starting Collection daemon..."
74 /usr/sbin/collectd -C /etc/collectd.conf
a332b303
CS
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 ;;
86esac
87
88# End $rc_base/init.d/collectd