Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 16th, 2000, 03:10 PM
d0g1e
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old May 19th, 2000, 06:36 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>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;

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > cannot display output on website

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap