|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I wrote a script to check the cpu usage of my rc5des cracker using the top command. i did it like this (this is a tiny part):
$cpu_usage = `top -n1 | grep "rc5des"`; $cpu_usage =~ s/ / /g; print $cpu_usage; (with the content-type, <html> tags etc) but it doesn't display the content when i visit the script via a browser. URL It DOES display it when running the script from console. The rest of the script works fine, because when i replace the top command width uname -n, it displayed the correct server name. please help URL -- d0g1e |
|
#2
|
|||
|
|||
|
>>It DOES display it when running the script from console.
Have you tried the full path to 'top' command like.. $cpu_usage = `/usr/bin/top -n 1 | grep "rc5des"`; I do not know exactly what are you trying to do with this script, maybe the following script should help you in some ways.. ############################################ #!/usr/local/bin/perl print "Content-type: text/htmlnn"; @top = `/usr/bin/top -n 1 | grep rc5des`; chop(@top); foreach $value (@top) { ($pid,$username,$pri,$nice,$size,$res,$state,$time,$wcpu,$cpu,$command) = split(/s+/,$value); print "$cpun"; } exit; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > cannot display output on website |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|