Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 06-24-2005, 20:00   #1 (permalink)
Charles Sweeney
Civilians

 
Default Server status script

Okay boys and girls, here's a little PHP script wot I wrote that outputs
the "top" command to your web browser screen.

For those who don't know, it's used on *nix systems and shows a snapshot of
running processes, memory usage, CPU load etc.

<?php

print "<pre>";

system("top -n1 b");

print "</pre>";

?>

"n1" is the number of iterations that the "top" command should run. "b" is
"batch" which allows the output to be written.

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 06-25-2005, 12:00   #2 (permalink)
Els
Civilians

 
Default Re: Server status script

Charles Sweeney wrote:

> Els wrote
>
>> Richard wrote:
>>
>>>> <?php
>>>> print "<pre>";
>>>> system("top -n1 b");
>>>> print "</pre>";
>>>> ?>
>>>
>>> I've tried it, but it only output "<pre></pre>" ?

>>
>> That's the outcome on my Windows box.
>> On Unix, I get this:
>> Warning: system() has been disabled for security reasons in
>> /home/.....

>
> Naturally, if a command is disabled it won't work!


I know :-)
Was just mentioning it, so Richard can see it does work on a Unix
system, even if it doesn't..

Hmm.. weird sentence <g>

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-25-2005, 12:00   #3 (permalink)
Charles Sweeney
Civilians

 
Default Re: Server status script

Els wrote

> Was just mentioning it, so Richard can see it does work on a Unix
> system, even if it doesn't..
>
> Hmm.. weird sentence <g>


It's ok, I understand!

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-25-2005, 12:00   #4 (permalink)
newsposting0209@webyourbusiness.com
Civilians

 
Default Re: Server status script

if system is disabled in php, then use shell script instead as a
cgi-script:

#!/bin/bash
echo "content-type: text/html


<PRE>`top -n1 b`</PRE>";exit 0


(it's also the same number of lines of code - including blanks).

hth

Greg
--
http://www.nod32usa.com

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-25-2005, 12:00   #5 (permalink)
Charles Sweeney
Civilians

 
Default Re: Server status script

wrote

> Greg


Hey good sir! How the devil are you?!

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-25-2005, 12:00   #6 (permalink)
Els
Civilians

 
Default Re: Server status script

newsposting0209@webyourbusiness.com wrote:

> if system is disabled in php, then use shell script instead as a
> cgi-script:
>
> #!/bin/bash
> echo "content-type: text/html
>
> <PRE>`top -n1 b`</PRE>";exit 0
>
> (it's also the same number of lines of code - including blanks).
>
> hth


Well, I think using shell is also blocked on the server I tried
system() on :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-25-2005, 12:00   #7 (permalink)
Charles Sweeney
Civilians

 
Default Re: Server status script

Els wrote

> newsposting0209@webyourbusiness.com wrote:
>
>> if system is disabled in php, then use shell script instead as a
>> cgi-script:
>>
>> #!/bin/bash
>> echo "content-type: text/html
>>
>> <PRE>`top -n1 b`</PRE>";exit 0
>>
>> (it's also the same number of lines of code - including blanks).
>>
>> hth

>
> Well, I think using shell is also blocked on the server I tried
> system() on :-)


You need to get yourself a proper server!

I think Greg was referring to the script running in shell, not your
access. Try it and find out.

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server Login Error while connecting from MPP to Project Server.Please help Sreejith Microsoft Applications 2 12-30-2006 07:34
Re: Email Status Requests in Project 2003 (w/o posting to the server) Mike Glen Microsoft Applications 1 07-16-2005 12:00
Possible to install Project 2003 Server on W2K3 Server DC?? screwie Microsoft Applications 1 11-18-2004 15:35
Battlezone Server Status xiongnu Gaming club 10 07-19-2004 19:03
SQL Server / Analysis Server as source for powerpoint charts Richm Microsoft Applications 2 06-16-2004 12:17


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 19:55.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.94158 seconds with 19 queries