aboutsummaryrefslogtreecommitdiffstats
path: root/cron.php
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-04-08 13:04:14 +0200
committerJulien Veyssier <julien-nc@posteo.net>2024-05-02 16:43:41 +0200
commit9814bffb7799cac8050c8c72b93fc90e7cac5e9a (patch)
tree8894ca6e3e42b7efff2520c231aa7664c92c98b9 /cron.php
parent9a3b341932b64e811fb043204c3f47cb8c62deb3 (diff)
downloadnextcloud-server-9814bffb7799cac8050c8c72b93fc90e7cac5e9a.tar.gz
nextcloud-server-9814bffb7799cac8050c8c72b93fc90e7cac5e9a.zip
chore(bg-jobs): add -h help option to cron.php
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'cron.php')
-rw-r--r--cron.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/cron.php b/cron.php
index f6ca95fe226..dc2d821fc57 100644
--- a/cron.php
+++ b/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()])) {