mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
chore(bg-jobs): add -h help option to cron.php
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
9a3b341932
commit
9814bffb77
1 changed files with 16 additions and 0 deletions
16
cron.php
16
cron.php
|
|
@ -57,6 +57,21 @@ use Psr\Log\LoggerInterface;
|
|||
try {
|
||||
require_once __DIR__ . '/lib/base.php';
|
||||
|
||||
if ($argv[1] === '-h' || $argv[1] === '--help') {
|
||||
echo 'Description:
|
||||
Run the background job routine
|
||||
|
||||
Usage:
|
||||
php -f cron.php -- [-h] [<job-class>]
|
||||
|
||||
Arguments:
|
||||
job-class Optional job class to only run those jobs
|
||||
|
||||
Options:
|
||||
-h, --help Display this help message' . PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (Util::needUpgrade()) {
|
||||
Server::get(LoggerInterface::class)->debug('Update required, skipping cron', ['app' => 'cron']);
|
||||
exit;
|
||||
|
|
@ -160,6 +175,7 @@ try {
|
|||
$endTime = time() + 14 * 60;
|
||||
|
||||
$executedJobs = [];
|
||||
// a specific job class can optionally be given as first argument
|
||||
$jobClass = isset($argv[1]) ? $argv[1] : null;
|
||||
while ($job = $jobList->getNext($onlyTimeSensitive, $jobClass)) {
|
||||
if (isset($executedJobs[$job->getId()])) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue