Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
emerge progress without turning on monitor (LED cpu load)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Ian Goldby
Guru
Guru


Joined: 18 May 2002
Posts: 539
Location: (Inactive member)

PostPosted: Fri Jul 04, 2003 9:37 pm    Post subject: emerge progress without turning on monitor (LED cpu load) Reply with quote

Check progress of emerge without turning on monitor (LED cpu load meter)

When doing a long emerge, it can be useful to know if it has finished or not without going to the trouble of turning the monitor on.

This short Bash script uses the keyboard LEDs as a primitive CPU load meter. Since it displays the 1 minute load-average, there is some delay in its response, but it is good enough for simple purposes. When all the LEDs are lit, the CPU is working hard at your emerge. When the load drops off, it has probably finished.

Note You must <ctrl>-<alt>-F1 to a plain console to use this. It doesn't work if you try to run it inside konsole in X, or similar. (To get back to X, use <ctrl>-<alt>-F7.)

Best thing is to save this to a file, e.g. ledload.sh, and then chmod 755 ledload.sh.

Code:
#!/bin/bash
#
# Display system load on the keyboard LEDs
# This must be run from a console (not inside X)

while [ 1 ]
do
  loadavg=`cut -d" " -f1 /proc/loadavg`
  if [[ $loadavg < 0.25 ]] ; then
    setleds -L -num -caps -scroll
  else
    if [[ $loadavg < 0.5 ]] ; then
      setleds -L +num -caps -scroll
    else
      if [[ $loadavg < 0.75 ]] ; then
        setleds -L +num +caps -scroll
      else
        setleds -L +num +caps +scroll
      fi
    fi
  fi
  sleep 5
done


Improvements: I'd like to display a more rapidly updating load. The 1 minute load average takes quite a while to get back to zero after a serious workout. I'd also like to find a reliable way to control the keyboard LEDs from within X.
Back to top
View user's profile Send private message
carl_f
n00b
n00b


Joined: 03 Jul 2003
Posts: 18
Location: Manchester, England UK

PostPosted: Fri Jul 04, 2003 11:01 pm    Post subject: Reply with quote

does anyone remember tleds ? maybe the source for that will be of use to you. tleds uses the keyboard leds as network activity indicators and are fucking wicked if you're on a ppp dialup link with an internal modem.
Back to top
View user's profile Send private message
Balthasar
n00b
n00b


Joined: 25 May 2003
Posts: 62
Location: Florida

PostPosted: Sat Jul 05, 2003 11:39 pm    Post subject: Reply with quote

Apparently there in now xtleds, as described in the homepage, that would probably be of some help.

* net-analyzer/tleds
Latest version available: 1.05_beta11
Latest version installed: [ Not Installed ]
Size of downloaded files: 33 kB
Homepage: http://www.hut.fi/~jlohikos/tleds/
Description: Blinks keyboard LEDs indicating outgoing and incoming network packets on selected network interface
Back to top
View user's profile Send private message
neenee
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1786

PostPosted: Thu May 20, 2004 9:47 am    Post subject: Reply with quote

did anyone ever update this script?
Back to top
View user's profile Send private message
Hrk
Tux's lil' helper
Tux's lil' helper


Joined: 24 May 2003
Posts: 90
Location: Rome, Italy

PostPosted: Mon May 24, 2004 10:42 am    Post subject: Re: emerge progress without turning on monitor (LED cpu load Reply with quote

Ian Goldby wrote:
When doing a long emerge, it can be useful to know if it has finished or not without going to the trouble of turning the monitor on.
[...]
Improvements: I'd like to display a more rapidly updating load. The 1 minute load average takes quite a while to get back to zero after a serious workout.


If what you need is a quick way to know if your long emerge has finished, you approach is not the best one (no offence meant) because it does not measure the status of the emerge process, but the cpu load.

You can know with precision if emerge has finished its job by doing a simple
Code:

if [ -z $(ps -A | grep emerge) ]; then
   echo "emerge is not here anymore: horray, the merge is complete! (or it failed... d'oh!)"
else
   echo "Gee, I should get a faster CPU or some distcc hosts..."
fi


This will work flawlessly with a single emerge process, which is the recommended usage (currently).

Hope to be of help. :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum