示例#1
0
 public function activate()
 {
     $pidfile = PID;
     $pid = ProcessHandler::getPID();
     if ($pid != null && $pid == getmypid()) {
         return "Already running!\n";
     } else {
         $fp = fopen($pidfile, "w+");
         if ($fp) {
             if (!fwrite($fp, "<" . "?php\n\$pid = " . getmypid() . ";\n?" . ">")) {
                 die("Can not create pid file!\n");
             }
             fclose($fp);
         } else {
             die("Can not create pid file!\n");
         }
     }
 }
    day of month	1-31
    month	 		1-12 (or names, see below)
    day of week	 	0-7 (0 or 7 is Sun, or use names)

    The sample above will run the script every 21 of each month at 10AM

****************************************************************************/
set_time_limit(0);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include dirname(__FILE__) . "/lib/admin.defines.php";
include dirname(__FILE__) . "/lib/ProcessHandler.php";
if (!defined('PID')) {
    define("PID", "/var/run/a2billing/a2billing_subscription_fee_pid.php");
}
// CHECK IF THE CRONT PROCESS IS ALREADY RUNNING
$pH = new ProcessHandler();
if ($pH->isActive()) {
    die;
    // Already running!
} else {
    $pH->activate();
}
$verbose_level = 1;
$groupcard = 5000;
$A2B = new A2Billing();
$A2B->load_conf($agi, NULL, 0, $idconfig);
write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[#### BATCH BEGIN ####]");
if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";
    write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");
    exit;
set_time_limit(0);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));

include (dirname(__FILE__) . "/lib/admin.defines.php");
include (dirname(__FILE__) . "/lib/ProcessHandler.php");

if (!defined('PID')) {
	define("PID", "/var/run/a2billing/a2billing_batch_billing_pid.php");
}

// CHECK IF THE CRONT PROCESS IS ALREADY RUNNING
if (ProcessHandler :: isActive()) {
	die(); // Already running!
} else {
	ProcessHandler :: activate();
}


//Flag to show the debuging information
$verbose_level = 0;

$groupcard = 5000;
$oneday = 24 * 60 * 60;

$A2B = new A2Billing();
$A2B->load_conf($agi, NULL, 0, $idconfig);

write_log (LOGFILE_CRONT_INVOICE, basename(__FILE__) . ' line:' . __LINE__ . "[#### CRONT BILLING BEGIN ####]");

if (!$A2B->DbConnect()) {
<?php

include_once "../php/DBHandler.php";
include_once "../php/Scheduler.php";
include_once "../php/ProcessHandler.php";
/*Haendler inizialesierung*/
$bts_handler = new DBHandler();
$bts_handler->connect();
$bts_handler->delete_old();
$bts_scheduler = new Scheduler();
$bts_ProcessHandler = new ProcessHandler();
$bts_ProcessHandler->setDummyProcessArray($bts_handler->get_processes());
/*Fuer Fehlerabfrage benoetigte Member*/
$fehlerDummy = '';
$fehlerRandom = '';
$fehlerRR = '';
$fehlerScheduler = '';
$fehler = false;
$openTab = 1;
/*Standart ueberpruefung erleichtern*/
function ueberpruefung($value)
{
    return isset($_POST[$value]) && !is_array($_POST[$value]) && $_POST[$value] != '';
}
if (isset($_POST['senden'])) {
    if ($_POST['senden'] == 'Speichern') {
        if (!(ueberpruefung('name') && strlen($_POST['name']) > 0 && strlen($_POST['name']) < 11)) {
            $fehlerDummy .= '<a>Bitte geben Sie einen Namen ein.</a><br />';
            $fehler = true;
        }
        if (!(ueberpruefung('cpulaufzeit') && $_POST['cpulaufzeit'] + 0 > 0 && $_POST['cpulaufzeit'] + 0 < 501)) {
    day of month	1-31
    month	 		1-12 (or names, see below)
    day of week	 	0-7 (0 or 7 is Sun, or use names)

    The sample above will run the script every day at 6AM

****************************************************************************/
set_time_limit(120);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include dirname(__FILE__) . "/lib/admin.defines.php";
include dirname(__FILE__) . "/lib/ProcessHandler.php";
if (!defined('PID')) {
    define("PID", "/var/run/a2billing/currencies_update_yahoo_pid.php");
}
// CHECK IF THE CRONT PROCESS IS ALREADY RUNNING
$prcHandler = new ProcessHandler();
if ($prcHandler->isActive()) {
    die;
    // Already running!
} else {
    $prcHandler->activate();
}
$FG_DEBUG = 0;
$A2B = new A2Billing();
$A2B->load_conf($agi, DEFAULT_A2BILLING_CONFIG, 1);
// DEFINE FOR THE DATABASE CONNECTION
define("BASE_CURRENCY", strtoupper($A2B->config["global"]['base_currency']));
$A2B->load_conf($agi, NULL, 0, $idconfig);
write_log(LOGFILE_CRONT_CURRENCY_UPDATE, basename(__FILE__) . ' line:' . __LINE__ . "[#### START CURRENCY UPDATE ####]");
if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";