View previous topic :: View next topic |
Author |
Message |
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Fri Jul 04, 2003 9:37 pm Post subject: emerge progress without turning on monitor (LED cpu load) |
|
|
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 |
|
|
carl_f n00b
Joined: 03 Jul 2003 Posts: 18 Location: Manchester, England UK
|
Posted: Fri Jul 04, 2003 11:01 pm Post subject: |
|
|
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 |
|
|
Balthasar n00b
Joined: 25 May 2003 Posts: 62 Location: Florida
|
Posted: Sat Jul 05, 2003 11:39 pm Post subject: |
|
|
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 |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Thu May 20, 2004 9:47 am Post subject: |
|
|
did anyone ever update this script? |
|
Back to top |
|
|
Hrk Tux's lil' helper
Joined: 24 May 2003 Posts: 90 Location: Rome, Italy
|
Posted: Mon May 24, 2004 10:42 am Post subject: Re: emerge progress without turning on monitor (LED cpu load |
|
|
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 |
|
|
|