Esempio n. 1
0
    //         'daemon" mode';
    // System_Daemon::info('{appName}  in %s %s/300', $a, $b);
    try {
        require_once 'lib/php/beanstalkd/ColaMensajes.php';
        $colaMensajes = new ColaMensajes("transformarvideos");
        $job = $colaMensajes->pop();
        if ($job == "") {
            //Time out
            //System_Daemon::info("Time out!");
        } else {
            $json = $job->getData();
            require_once 'modulos/videos/controladores/videoControlador.php';
            if (transformar($json)) {
                System_Daemon::notice('Video transformado correctamente');
            } else {
                System_Daemon::info("ERROR! el resultado de la transformación no es cero");
            }
            $colaMensajes->deleteJob($job);
        }
    } catch (Exception $e) {
        System_Daemon::info('ERROR! %s', $e->getMessage());
    }
    if (!$runningOkay) {
        System_Daemon::err('parseLog() produced an error, ' . 'so this will be my last run');
    }
    // Relax the system by sleeping for a little bit iterate also clears statcache
    System_Daemon::iterate(2);
}
// Shut down the daemon nicely
// This is ignored if the class is actually running in the foreground
System_Daemon::stop();
Esempio n. 2
0
 * /var/log/optest.log
 * 
 */
// Make it possible to test in source directory
// This is for PEAR developers only
ini_set('include_path', ini_get('include_path') . ':..');
// Include Class
error_reporting(E_ALL);
require_once 'System/Daemon.php';
// Bare minimum setup
System_Daemon::setOption('appName', 'optest');
System_Daemon::setOption('authorEmail', '*****@*****.**');
System_Daemon::setOption('logLocation', '/var/log/sysdaemon.devtest.log');
System_Daemon::setOption('logFilePosition', true);
System_Daemon::warning('{appName} daemon encountered an empty appPidLocation');
System_Daemon::err('{appName} daemon encountered an empty appPidLocation');
die;
$options = array();
$options['appName'] = 'devtest';
$options['appExecutable'] = 'devtest.php';
$options['appDir'] = realpath(dirname(__FILE__));
$options['appDescription'] = 'Developer test daemon';
$options['authorName'] = 'kevman';
$options['authorEmail'] = '*****@*****.**';
if (($os = System_Daemon_OS::factory('BSD')) === false) {
    echo 'Cannot create OS\\n';
} else {
    print_r($os->errors);
    echo '\\n';
    echo $os->getAutoRunTemplatePath();
    echo '\\n';