Koozali.org: home of the SME Server

Show Uptime

wykyd

Show Uptime
« on: September 09, 2003, 06:14:55 AM »
is there a way to show the systems uptime on a HTML page?

Terry

Re: Show Uptime
« Reply #1 on: September 09, 2003, 07:18:59 AM »

wykyd

Re: Show Uptime
« Reply #2 on: September 09, 2003, 09:19:21 AM »
Thanx alot

Patrick F. Ducharme

Re: Show Uptime
« Reply #3 on: September 09, 2003, 08:44:02 PM »
also, this code will let you put it where You want on a Web Page.

   $uptime_array = explode(" ", exec("cat /proc/uptime"));
   $seconds = round($uptime_array[0], 0);
   $minutes = $seconds / 60;
   $hours = $minutes / 60;
   $days = floor($hours / 24);
   $hours = floor($hours - ($days * 24));
   $minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
   $seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60));
   $uptime_array = array($days, $hours, $minutes, $seconds);
   
   print("Uptime : " . $uptime_array[0] . " jour(s) " . $uptime_array[1] . " heure(s) " . $uptime_array[2] . " minute(s) " . $uptime_array[3] . " seconde(s)");
?>

Jim Huneycutt

Re: Show Uptime
« Reply #4 on: October 20, 2003, 11:24:47 AM »
Patrick,
I am trying to use the exec or "backtick" php operator to execute a unison file synchronization from a php page on a 5.5 server. I can execute "unison -verision" just fine. When I try "unison {preffile}" nothing happens. Is this perhaps a permission problem?

The unison preference files reside in /root/.unison. I note that a php exec command using "ls -al" will only work in the directory in which the php file is located. I have searched for the limitations of exec (or shell_exec, or "backtick") but it is hard to find anything on unison, and specifically for unison on e-Smith.

I have tried to place the simple Unison synchronization command in a .sh script but that also fails to run.

I have used the Unison server-manager addon, but I do not want to turn that over to a user - I just want the "synchronize now" feature so I am trying to duplicate that functionality with a simple unison php page accessible by users' desktops.

I am also looking for an updated Unison rpm (I have 2.7.7) to run on ver 6.0b3. Anyone have a link for this?

Thanks