]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/collectd
5a735ee306072fdcce58aa0927b630038e218406
2 # Begin $rc_base/init.d/collecd
8 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/main
/settings
)
10 if [ "$RRDLOG" = '' ]; then
16 # At first run search for sensors with sensors-detect
17 if [ ! -e /etc
/sysconfig
/lm_sensors
]; then
18 boot_mesg
"Searching for Sensors..."
19 "yes" |
/usr
/sbin
/sensors-detect
> /dev
/null
22 if [ ! -e /etc
/sysconfig
/lm_sensors
]; then
23 echo "#No Sensors detected " > /etc
/sysconfig
/lm_sensors
27 boot_mesg
-n "Loading Sensor Modules..."
28 for modul
in `cat /etc/sysconfig/lm_sensors | grep '^MODULE_' | cut -d"=" -s -f2`; do
29 modprobe
$modul > /dev
/null
2>&1;
31 boot_mesg
-n "$SUCCESS$modul$NORMAL ";
33 boot_mesg
-n "$FAILURE$modul$NORMAL ";
39 # Enable sensors plugin if sensors found
40 if [ $
( sensors
2>&1 |
grep "No sensors found!" |
wc -l ) == "1" ]; then
41 sed -i -e "s|^LoadPlugin sensors|#LoadPlugin sensors|g" /etc
/collectd.conf
43 sed -i -e "s|^#LoadPlugin sensors|LoadPlugin sensors|g" /etc
/collectd.conf
46 # Enable thermal plugin if thermal_zone found
47 if [ ! -e /sys
/class
/thermal
/thermal_zone0
]; then
48 sed -i -e "s|^LoadPlugin thermal|#LoadPlugin thermal|g" /etc
/collectd.conf
50 sed -i -e "s|^#LoadPlugin thermal|LoadPlugin thermal|g" /etc
/collectd.conf
53 # Enable swap plugin if swap found
54 if [ "$(swapon -s | wc -l)" == "1" ]; then
55 sed -i -e "s|^LoadPlugin swap|#LoadPlugin swap|g" /etc
/collectd.conf
57 sed -i -e "s|^#LoadPlugin swap|LoadPlugin swap|g" /etc
/collectd.conf
60 boot_mesg
"Starting Collection daemon..."
61 /usr
/sbin
/collectd
-C /etc
/collectd.conf
65 # Save the ramdisk at manual stop but not at shutdown
66 if [ "$(basename $0)" == "collectd" ]; then
67 /etc
/init.d
/tmpfs backup
69 boot_mesg
"Stopping Collection daemon..."
70 killproc
/usr
/sbin
/collectd
79 statusproc
/usr
/sbin
/collectd
83 echo "Usage: $0 {start|stop|restart|status}"
88 # End $rc_base/init.d/collectd