Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Attempting to alter a perl script.

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
EvilGrin
n00b
n00b
User avatar
Posts: 23
Joined: Mon Oct 27, 2003 8:49 pm

Attempting to alter a perl script.

  • Quote

Post by EvilGrin » Sat Feb 21, 2004 11:27 pm

I'm attempting to alter a 'sysinfo' script to display the output of my System and CPU tempratures. The situation is compilcated by the fact I know very little about perl and that I have a dual processor machine. The current code doesn't work, the output from 'sensors' is different from what the script expects. It uses two variables one for the sys temp and one for the cpu temp. Obviously I'll need a 3rd variable for the second CPU temp.

The current code looks like this:

Code: Select all

sub temp
{
    #--LM_SENSORS #1--#
    $SENSOR1 = `sensors -f | grep SYS | awk '{print \$1, \$2, \$3}'`;
    chop ($SENSOR1);

    #--LM_SENSORS #2--#
    $SENSOR2 = `sensors -f | grep 'CPU Temp' | awk '{print \$1, \$2, \$3}'`;
    chop ($SENSOR2);

    #--SPEW IT INTO THE CHANNEL SHALL WE--#
IRC::command("$SENSOR1 $SENSOR2");
return 1;
}
basically I want the contents of 3 variables to contain.

Code: Select all

$SENSOR1 = System Temp: xxx°C 
$SENSOR2 = CPU0 Temp: xxx°C 
$SENSOR3 = CPU1 Temp: xxx°C
my 'sensors' output looks like this for system, cpu0 and then cpu1:

Code: Select all

bash-2.05b$ sensors lm79-i2c-1-2d | grep temp
temp:      +25.0°C  (limit =  +60°C, hysteresis =  +50°C)
bash-2.05b$ sensors lm75-i2c-1-4c | grep temp
temp:      +60.0°C  (limit = +120.0°C, hysteresis = +100.0°C)
bash-2.05b$ sensors lm75-i2c-1-4d | grep temp
temp:      +64.0°C  (limit = +120.0°C, hysteresis = +100.0°C)
Top
TheEternalVortex
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Tue Oct 15, 2002 6:38 am
Location: San Jose, CA
Contact:
Contact TheEternalVortex
Website

  • Quote

Post by TheEternalVortex » Sun Feb 22, 2004 8:25 am

Try looking at the output of these commands:
sensors -f | grep SYS | awk '{print $1, $2, $3}'
sensors -f | grep 'CPU Temp' | awk '{print $1, $2, $3}'
-- Andy
Top
Post Reply

2 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy