Comment 4 for bug 643565

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hey guys, what about this then:

"""
=== modified file 'debian/landscape-sysinfo.wrapper' (properties changed: -x to +x)
--- debian/landscape-sysinfo.wrapper 2010-07-23 08:28:59 +0000
+++ debian/landscape-sysinfo.wrapper 2011-01-12 22:18:56 +0000
@@ -1,5 +1,7 @@
 #!/bin/sh
-if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < 1.0" | bc) -eq 1 ]; then
+cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
+threshold="${cores:-1}.0"
+if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $cores" | bc) -eq 1 ]; then
     echo
     echo -n " System information as of "
     /bin/date
@@ -7,5 +9,5 @@
     /usr/bin/landscape-sysinfo
 else
     echo
- echo " System information disabled due to load higher than 1"
+ echo " System information disabled due to load higher than $threshold"
 fi
"""

It just uses the number of cores, which is a good start. I don't want to get too fancy here, as doing heavy things at login time was what prompted the original bug in the first place.