From: Arne Fitzenreiter Date: Sat, 2 Jun 2012 08:17:34 +0000 (+0200) Subject: collectd: fix collectd on machines without rtc. X-Git-Tag: v2.11-core61^2~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15eb7e0a7f984482b8a8ec58131c8797dfe7537a;p=people%2Fms%2Fipfire-2.x.git collectd: fix collectd on machines without rtc. 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. --- diff --git a/src/initscripts/init.d/collectd b/src/initscripts/init.d/collectd index bdb5ca2f0b..544b3e1f14 100644 --- a/src/initscripts/init.d/collectd +++ b/src/initscripts/init.d/collectd @@ -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..."