Parser pid renew

This commit is contained in:
magnolia-fan 2011-04-02 00:55:55 +04:00
parent 2958009bc1
commit d411680b1b

View File

@ -3,35 +3,39 @@
require_once 'common.php'; require_once 'common.php';
$db = Db::getInstance(); $db = Db::getInstance();
$rows = $db->getRows($db->q("SELECT status, count(*) as cnt FROM beathaven.queue GROUP BY status")); $rows = $db->getRows($db->q("SELECT status, count(*) as cnt FROM beathaven.queue GROUP BY status"));
$info = array_fill(0, 3, 0); $info = array_fill(0, 3, 0);
foreach ($rows as $row) { foreach ($rows as $row) {
$info[$row['status']] = $row['cnt']; $info[$row['status']] = $row['cnt'];
} }
$pid = @file_get_contents('/www/parser_data/pid');
$tmp = exec("ps aux | grep parse_queue"); $tmp = exec("ps ". $pid);
$running = (strpos($tmp, '/opt/local/bin/php') !== false) ? 1 : 0; $running = (strpos($tmp, '/opt/local/bin/php') !== false) ? 1 : 0;
?> ?>
<html> <html>
<head> <head>
<title>BeatHaven</title> <title>BeatHaven</title>
<style> <meta http-equiv="refresh" content="5" />
body, td {padding:0;margin:0;} <style>
body {background-color:#112;} body, td {padding:0;margin:0;}
.status-1 {font: 10em Georgia; color: #FFF;} body {background-color:#112;}
.status-02 {font: 0.8em Georgia; color: #AAA;} .status-1 {font: 10em Georgia; color: #FFF;}
.running-1 {font: 0.8em Georgia; color: #8A8;} .status-02 {font: 0.8em Georgia; color: #AAA;}
.running-0 {font: 0.8em Georgia; color: #A88;} .running-1 {font: 0.8em Georgia; color: #8A8;}
</style> .running-0 {font: 0.8em Georgia; color: #A88;}
</head> </style>
<body> </head>
<table width="100%" height="100%"><tr><td align="center" valign="middle"> <body>
<span class="status-1"><?= $info[1] ?></span><span class="status-02"> / <?= $info[0] ?> / <?= $info[2] ?></span> <table width="100%" height="100%">
<span class="running-<?= $running ?>"><?= ($running ? 'running' : 'stopped') ?></span> <tr>
</td></tr></table> <td align="center" valign="middle">
</body> <div style="float:left;width:100px;height:1;">&nbsp;</div>
<span class="status-1"><?= $info[1] ?></span>
<span class="status-02"> / <?= $info[0] ?> / <?= $info[2] ?></span>
<span class="running-<?= $running ?>"><?= ($running ? 'running' : 'stopped') ?></span>
</td>
</tr>
</table>
</body>
</html> </html>