- - - - -

Uptime script


  • Please log in to reply
4 replies to this topic

#1 Logan

Logan

    Very Large Orange

  • Members
  • PipPipPipPipPip
  • 482 posts

Posted 30 September 2005 - 07:22 PM

Yes, this is an extraordinarily simple PHP script to do what ASO's servers do here on your own VPS or Dedicated server: http://servername.asmallorange.com/uptime.php
  
  Execute a shell command and return it's output is all it is doing, and in this case it's the "uptime" command, so you can see the average load, users logged in via shell, and how long the server has been up via your browser.
  
  Save this code as 'uptime.php' or name it whatever you want as long as it has the .php extension, upload it to your site, and you can then access it via your web browser. smile.gif
  
CODE

<?php
$uptime = shell_exec('uptime');
echo "$uptime";
?>    


#2 -ASO- Tim

-ASO- Tim

    Former Head Orange

  • Members
  • PipPipPipPipPipPipPip
  • 5,239 posts

Posted 30 September 2005 - 11:53 PM

Actually, it's simpler than that and I've included it on the new VPS cPanel images:

CODE
<?php echo `uptime`; ?>


Backticks execute stuff on the command line and return the result smile.gif
Former Owner/Manager
timdorr.com

#3 jaseone

jaseone

    Massive Orange

  • Members
  • PipPipPipPipPipPipPip
  • 2,193 posts

Posted 01 October 2005 - 12:07 AM

I assumed uptime.php must have been something included with WHM as it has always been there for vps.jasonbainbridge.com.
Jason Bainbridge
An Aussie geek stuck in Texas
Road Show Blondes - Follow the Road Show as we drive from Houston to New York City to raise awareness and money for suicide prevention with The Jed Foundation.

#4 evn

evn

    Very Large Orange

  • Members
  • PipPipPipPipPip
  • 487 posts

Posted 01 October 2005 - 12:40 AM

<smartass>
Hard to get much simpler than:
CODE
<?=`uptime`?>

</smartass>
IPB Image

#5 Logan

Logan

    Very Large Orange

  • Members
  • PipPipPipPipPip
  • 482 posts

Posted 01 October 2005 - 08:37 AM

QUOTE(evn @ Oct 1 2005, 2:40 AM) View Post
<smartass>
Hard to get much simpler than:
CODE
<?=`uptime`?>

</smartass>

laugh.gif





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users