LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-16-2004, 03:13 AM   #1
Das0
LQ Newbie
 
Registered: Feb 2004
Posts: 3

Rep: Reputation: 0
Displaying Uptime


How can I go about adding my slackware box' uptime to my webpage? Any thoughts/ideas or any help really would be great.
 
Old 02-16-2004, 06:06 AM   #2
Das0
LQ Newbie
 
Registered: Feb 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Bump ... any help pls
 
Old 02-16-2004, 07:13 AM   #3
amos
Member
 
Registered: Dec 2002
Location: Bolton, UK
Distribution: Kubuntu
Posts: 224

Rep: Reputation: 30
I would have thought that there would be something in /proc you could use.

Cheers
Amos
 
Old 02-16-2004, 07:19 AM   #4
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
A simple CGI with some sort of system-like call (depending on what language you use) to uptime should be fine. You need to be more specific with what kinds of tools you're willing to use.
 
Old 02-16-2004, 07:35 AM   #5
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 464

Rep: Reputation: 52
Here is a snipet of code (php I believe) I cut out of our webserver pages that will do it. It puts the output of the system command uptime in the variable uptimereturn, reformats the variable, and extracts local time (the first variable) and uptime (the 3rd variable) w/units, (the 4th variable). These are printed in a table.

#server info stuff:
$uptimereturn=exec(uptime);

$systat=explode(",",$uptimereturn);
$systat[0]=trim($systat[0]);
$times=explode(" ",$systat[0]);
<div align=\"center\"> <font size=\"+1\">Web Server Information:</font></div>< <table width=\"60%\" align=\"center\">
<tr><td width=\"40%\">
Local Time:
</td><td width=\"60%\">
$times[0]
</td></tr>
<tr><td width=\"40%\">
Up Time:
</td><td width=\"60%\">
$times[3] $times[4]
</td></tr>
</table>
 
Old 02-16-2004, 02:56 PM   #6
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
Pretty sure that uptime needs to be in quotes up there.
 
Old 02-16-2004, 04:37 PM   #7
Das0
LQ Newbie
 
Registered: Feb 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Ok thanks for the help I made a .cgi


#!/bin/sh

echo "Content-Type: text/html\n\n"
uptime
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Uptime: 2.4 vs 2.6 Synesthesia Linux - General 4 10-17-2005 03:23 PM
24/7 uptime? jollyjoice General 20 01-25-2005 11:12 AM
Internet uptime plexy Linux - Networking 2 11-02-2003 10:42 AM
uptime skate Linux - Software 16 08-14-2003 03:10 AM
RedHat 6.2 uptime mjakob Linux - General 5 12-14-2002 10:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration