Create getcronjobstatus.inc.php

This commit is contained in:
ahmedbodi 2014-01-23 10:29:01 +00:00
parent 6b52d47ab2
commit ece8b3adf6

View File

@ -0,0 +1,56 @@
<?php
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
// Check if the API is activated
$api->isActive();
// Check user token
$user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']);
if (!$user->isAdmin($user_id)) {
die("404 Page not found");
}
// Default crons to monitor
$aCrons = array('statistics','payouts','token_cleanup','archive_cleanup','blockupdate','findblock','notifications','tickerupdate','liquid_payout');
// Special cases, only add them if activated
switch ($config['payout_system']) {
case 'pplns':
$aCrons[] = $config['payout_system'] . '_payout';
break;
case 'pps':
$aCrons[] = $config['payout_system'] . '_payout';
break;
case 'prop':
$aCrons[] = 'proportional_payout';
break;
}
// Data array for template
foreach ($aCrons as $strCron) {
$aCronStatus[$strCron] = array(
'disabled' => $monitoring->getStatus($strCron . '_disabled'),
'exit' => $monitoring->getStatus($strCron . '_status'),
'active' => $monitoring->getStatus($strCron . '_active'),
'runtime' => $monitoring->getStatus($strCron . '_runtime'),
'starttime' => $monitoring->getStatus($strCron . '_starttime'),
'endtime' => $monitoring->getStatus($strCron . '_endtime'),
'message' => $monitoring->getStatus($strCron . '_message'),
);
}
// Output JSON format
$data = array(
'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ),
'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => $aUserRoundShares),
'pool' => array( 'hashrate' => $dPoolHashrateAdjusted, 'shares' => $aRoundShares ),
'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ),
);
echo $api->get_json($data);
// Supress master template
$supress_master = 1;
?>