Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Server Uptime + Free Space/Total Space

Empfohlene Antworten

Veröffentlicht

Hier habt ihr mal ein kleines "Script" von mir, welches ich auf meiner Mini-Site eingebaut habe im Admin-Bereich.

Uptime

--------------------------------------------------------------------

In die Datei einfügen:


<?php

//Uptime
$host = "EUER HOST"; //Standard: localhost
$file = filemtime("c:/pagefile.sys"); //Pfad ggf. anpassen
$up = time() - $file;
$days = floor($up / 86400);
$up -= ($days * 86400);
$minutes = floor($up / 3600);
$up -= ($minutes * 3600);
$seconds = floor($up / 60);
$up -= ($minutes * 60);

$uptime = $days." Days ".$hours." Hours ".$minutes." Minutes";

?>
[/PHP]

Den Eintrag <? $uptime ?> an der Stelle hinzufügen, wo ihr ihn haben wollt.

------------------------------------------------------------------------

Free Space / Total Space

In Datei hinzufügen:

[PHP]
<?
function mksize($free)
{
if ($free < 1000 * 1024)
return number_format($free / 1024, 2) . " kB";
elseif ($free < 1000 * 1048576)
return number_format($free / 1048576, 2) . " MB";
elseif ($free < 1000 * 1073741824)
return number_format($free / 1073741824, 2) . " GB";
else
return number_format($free / 1099511627776, 2) . " TB";
}

function mksizeint($total)
{
if ($total< 1000 * 1024)
return number_format($total / 1024, 2) . " kB";
elseif ($total < 1000 * 1048576)
return number_format($total / 1048576, 2) . " MB";
elseif ($total < 1000 * 1073741824)
return number_format($total / 1073741824, 2) . " GB";
else
return number_format($total / 1099511627776, 2) . " TB";
}

?>

Den Eintrag <?=mksize($free) ?> sowie <?=mksizeint($total) ?> an den Stellen hinzufügen, wo ihr sie haben wollt.

Ahja,

dachte nur weil man unter >> Skript- und Webserverprogrammierung << auch verstehen könnte, dass man das posten kann, was man gebaut/eingebaut/etc. hat.

Aber vielleicht findet der eine die Sachen ja nützlich/unnütz :D

  • 2 Wochen später...

wie auch im anderen thread gepostet, ist dein code snippet äusserst suboptimal.

- was machst du, wenn du keinen zugriff auf pagefile.sys hast?

- was machst du, wenn pagefile.sys nicht auf c:\ liegt - viele systeme - schon ab XP - lagern auf mehrere LW aus.

- unter linux und anderen unixoiden (freebsd, sunos, solaris) funktioniert das genau garnicht.

- wozu dient deine variable $host nochmals? :floet:

man sollte IMO daher bevorzugt PHP: W32api Functions - Manual und dort die performance counters nutzen.

s'Amstel

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.