예제 #1
0
파일: cli-sender.php 프로젝트: kenjs/Goteo
        //end while
    }
    if ($debug) {
        echo "dbg: desbloqueo este registro\n";
    }
    Model::query('UPDATE mailer_content SET blocked = 0 WHERE id = ?', array($mailing->id));
} else {
    if ($debug) {
        echo "dbg: FALLO\n";
    }
}
if ($debug) {
    echo "dbg: FIN, tiempo de ejecución total " . round(microtime(true) - $itime, 2) . " segundos para enviar {$total_users} emails, ratio medio " . round($total_users / (microtime(true) - $itime), 2) . " emails/segundo\n";
}
// limpiamos antiguos procesados
Sender::cleanOld();
/**
 * Comprueba si se está ejecutando un proceso cli-sendmail.php con un pid determinado
 * @param  [type] $pid [description]
 * @return [type]      [description]
 */
function check_pid($args, $pid = null)
{
    $filter = escapeshellarg(escapeshellcmd(__DIR__ . "/cli-sendmail.php {$args}"));
    $order = "ps x | grep {$filter} | grep -v grep | awk '{ print \$1 }'";
    // $order = "pgrep -f $filter";
    $lines = shell_exec($order);
    if ($lines) {
        // echo "[$pid] ";print_r($lines);print_r($order);
        if ($pid) {
            $lines = array_map('trim', explode("\n", $lines));