mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-09 23:08:42 +00:00
32 lines
705 B
PHP
32 lines
705 B
PHP
<?php
|
|
|
|
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__);
|
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/app/vendor/autoload.php';
|
|
require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php';
|
|
|
|
// Create a new scheduler
|
|
$scheduler = new GO\Scheduler([
|
|
'tempDir' => '/tmp'
|
|
]);
|
|
|
|
echo '[UOJScheduler] Init', "\n";
|
|
|
|
// =========== JOBS ===========
|
|
|
|
// Email
|
|
$scheduler->call('UOJMail::cronSendEmail', [], 'cronSendEmail')
|
|
->at('* * * * *')
|
|
->onlyOne()
|
|
->before(function () {
|
|
echo "[cronSendEmail] started at " . time() . "\n";
|
|
})
|
|
->then(function () {
|
|
echo "[cronSendEmail] ended at " . time() . "\n";
|
|
});
|
|
|
|
// ============================
|
|
|
|
// Let the scheduler execute jobs which are due.
|
|
$scheduler->run();
|