]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
collectd: fix collectd on machines without rtc.
authorArne Fitzenreiter <arne_f@ipfire.org>
Sat, 2 Jun 2012 08:17:34 +0000 (10:17 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sat, 2 Jun 2012 08:17:34 +0000 (10:17 +0200)
collectd hangs with 100% cpu usage if there is a very old entry
in the database. This was created at the first start without internet so
ntp cannot set the time.

src/initscripts/init.d/collectd

index bdb5ca2f0bcebf0dd095717dca65b24a47566627..544b3e1f1472af9c4660a91f16b5db041ac6ae27 100644 (file)
@@ -86,9 +86,14 @@ case "$1" in
                        sed -i -e "s|^#LoadPlugin swap|LoadPlugin swap|g" /etc/collectd.conf
                fi
 
-               boot_mesg "Starting Collection daemon..."
-               /usr/sbin/collectd -C /etc/collectd.conf
-               evaluate_retval
+               if [ $(date +%Y) -gt 2011 ]; then
+                       boot_mesg "Starting Collection daemon..."
+                       /usr/sbin/collectd -C /etc/collectd.conf
+                       evaluate_retval
+               else
+                       boot_mesg "collectd: cannot start with incorrect time ($(date))."
+                       echo_warning;
+               fi
                ;;
        stop)
                boot_mesg "Stopping Collection daemon..."