Scritto da Stoker
Ho creato un piccolo script bello per me che visualizza uptime del server e carico medio.
Lo troverete nelle sezione statistiche sia sul portale che su indice del forum:
Server uptime 98 giorni, 15 ore, 38 minuti e 32 secondi
Carico medio 0.07 • 0.03 • 0.01
Vi mostrerò come inserirlo sull'indice
Apri: index.php
Cerca:
Codice: Seleziona tutto
$total_users = $config['num_users'];
Codice: Seleziona tutto
$uptimeindex = shell_exec("cut -d. -f1 /proc/uptime");
$daysindex = floor($uptimeindex/60/60/24);
$hoursindex = $uptimeindex/60/60%24;
$minsindex = $uptimeindex/60%60;
$secsindex = $uptimeindex%60;
$load = sys_getloadavg();
Codice: Seleziona tutto
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
Codice: Seleziona tutto
'UPTIME_DAYS' => $daysindex,
'UPTIME_HOURS' => $hoursindex,
'UPTIME_MINS' => $minsindex,
'UPTIME_SECS' => $secsindex,
'AVG_LOAD0' => $load[0],
'AVG_LOAD1' => $load[1],
'AVG_LOAD2' => $load[2],
Apri: styles/prosilver/template/index_body.html
Cerca:
Codice: Seleziona tutto
<p>{TOTAL_POSTS} • {TOTAL_TOPICS} • {TOTAL_USERS} • {NEWEST_USER}
Codice: Seleziona tutto
<br />
{L_SERVER_UPTIME}: <strong>{UPTIME_DAYS}</strong> days, <strong>{UPTIME_HOURS}</strong> hours, <strong>{UPTIME_MINS}</strong> minutes and <strong>{UPTIME_SECS}</strong> seconds<br />
{L_AVERAGE_LOAD}: <strong>{AVG_LOAD0}</strong> • <strong>{AVG_LOAD1}</strong> • <strong>{AVG_LOAD2}</strong>
Cerca:
Codice: Seleziona tutto
?>
Codice: Seleziona tutto
// Server Uptime
$lang = array_merge($lang, array(
'SERVER_UPTIME' => 'Uptime del server',
'AVERAGE_LOAD' => 'Carico medio',
));