D. Ben Noble wrote: > I have a question for you which may be a problem with PowerTOP, > alternatively, it may be a problem with Cron. > > I have written an ugly little script and I have run into an issue which I > believe may be a bug, please take a second to check this out, and, if you > have time, shed some light... > > The script that I have written is as follows: > > #!/bin/bash -e > powertop -t 3 -d 1 > /media/disk/powertop_raw > txt2html --infile /media/disk/powertop_raw --title "power usage" > --prepend_file /media/disk/web/txt2htmlhead.html --append_file > /media/disk/web/txt2htmlfoot.html --outfile /media/disk/web/powertop.html > sudo -u nobody cp /media/disk/web/powertop.html /media/disk/web/index.html > exit 0 > > ...Essentially writing the PowerTOP output to a webpage. > > Here is the weird thing, if I run it directly from the BASH prompt, it works > just great, if I run it as a Cron job, it fails miserably at the first step, > with the symptoms that you see in the subject, the -NaN valiues and a > truncated wake-up list. > > An example of the incorrect values are as follows: > > PowerTOP 1.9 (C) 2007 Intel Corporation > > Collecting data for 6 seconds > Cn Avg residency > C0 (cpu running) ( nan%) > C1 0.0ms ( nan%) > C2 0.0ms ( nan%) > C3 0.0ms ( nan%) > P-states (frequencies) > no ACPI power usage estimate available > Top causes for wakeups: > > Suggestion: Enable USB autosuspend by pressing the U key or adding > usbcore.autosuspend=1 to the kernel command line in the grub config > > The Cron job is being run as Root. > > When run as a Cron job, it fails at the first step, when writing the output > to the powertop_raw file. Again, if I run it from the BASH prompt, it goes > just swimmingly. > > I have tried saving the script as a file and running it from Cron as well as > just pasting that huge ugly string directly in the crontab itself. > > I am running Powertop 1.9-1 on Ubuntu 7.10. > > Thoughts? >
I think it's a powertop bug. I don't have C-states here so it's not a direct comparison. But I get something suspicious. If I run "powertop -d < /dev/null" (which is kinda what cron does), it terminates *instantly*, showing an empty wakeup list. I bet that's what happens for you, and "NaN" means "I tried to divide by zero seconds". Regards Alan _______________________________________________ Discuss mailing list Discuss@LessWatts.org http://mail.lesswatts.org/mailman/listinfo/discuss