#!/usr/bin/perl ##################################### # SystemLed v 0.3 # Http:www.Sorgonet.com # GNU(GPL)License http:www.gnu.org # 2004-05-03 # # Dalamar at Sorgonet.com # Drdoom at Sorgonet.com # Necro_ at Sorgonet.com #################################### use Device::ParallelPort; use Device::ParallelPort::drv::linux; my $port = Device::ParallelPort->new('linux'); $port->set_byte(0, chr(0)); $port->set_byte(2, chr(0)); $port->set_byte(1, chr(0)); $port->set_control(chr(11)); $a=0; my $thesecond_2; my $timefunction=0; my $time_this_function=0; while (1){ my $thesecond=`date "+%S"`; if ($timefunction==0){#Time my $thehour=`date "+%I"`; my $theminute=`date "+%M"`; $port->set_data(chr($theminute)); if ($thehour>12){$thehour=$thehour-12;} if (($thehour-8) > -1) { $bit_hour_8=0;$thehour=$thehour-8; }else {$bit_hour_8=8;} if (($thehour-4) > -1) { $bit_hour_4=4;$thehour=$thehour-4;}else {$bit_hour_4=0;} if (($thehour-2) > -1) { $bit_hour_2=0;$thehour=$thehour-2;}else {$bit_hour_2=2;} if (($thehour-1) > -1) { $bit_hour_1=0;$thehour=$thehour-1;}else {$bit_hour_1=1;} my $sum=$bit_hour_1+$bit_hour_2+$bit_hour_4+$bit_hour_8; $port->set_control(chr($sum)); if ($thesecond_2!=$thesecond){ $thesecond_2=$thesecond; $port->set_bit(6,1); $time_this_function=$time_this_function+1; if ($time_this_function==10){$time_this_function=0;$timefunction=1;}}else{$port->set_bit(6,0);}} if ($timefunction==1){#Memory my $meninfo=`cat /proc/meminfo`; if ($meninfo =~/MemFree:\s+(\d+)/){$menactual=$1;} if ($meninfo =~/MemTotal:\s+(\d+)/){$mentotal=$1;} my $menocu=$mentotal-$menactual; my $porcentualmen= int((($menocu*6)/$mentotal)); $porcentualmen=(6-$porcentualmen); $porcentualmen=(2**$porcentualmen)-1; $port->set_data(chr(63-$porcentualmen)); $port->set_bit(6,1); $port->set_control(chr(3)); if ($thesecond_2!=$thesecond){ $thesecond_2=$thesecond; $time_this_function=$time_this_function+1; if ($time_this_function==4){$time_this_function=0;$timefunction=2;}}} if ($timefunction==2){#HDD my $spaceinfo=`df`; if ($spaceinfo =~ /.dev.hda.\s+\d+\s+(\d+).+ [^\/]/){$hdaocuped=$1;} if ($spaceinfo =~ /.dev.hda.\s+(\d+)\s+\d+.+ [^\/]/){$hdaactual=$1;} my $porcentualmen= int((($hdaocuped*6)/$hdaactual)); $porcentualmen=(6- $porcentualmen); $porcentualmen=(2**$porcentualmen)-1; $port->set_data(chr(63-$porcentualmen)); $port->set_bit(6,1); $port->set_control(chr(15)); if ($thesecond_2!=$thesecond){ $thesecond_2=$thesecond; $time_this_function=$time_this_function+1; if ($time_this_function==4){$time_this_function=0;$timefunction=0;}}} }