Hi guys,
Host: proxmox
VM: Ubuntu server 18.04.5 LTS.
Nextcloud: 20.0.4
Everything updated
I run Nginx Proxy Manager as my reverse proxy also in a separate container.
I installed Nextcloud via the docker-compose example but I customized it of course… insecure/mariadb-cron-redis/apache/docker-compose.yml
My docker-compose file:
version: '3'
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- ./nextcloud/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=XXXXXXXX
- MYSQL_PASSWORD=XXXXXXXX
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
redis:
image: redis:alpine
restart: always
app:
image: nextcloud:latest
restart: always
ports:
- 8888:80
volumes:
- ./nextcloud:/var/www/html
- /media/vdb/data:/var/www/html/data # RAIDZ1 Big storage
- ./nextcloud/config:/var/www/html/config
- ./nextcloud/apps:/var/www/html/apps
- ./nextcloud/php.ini:/usr/local/etc/php/conf.d/zzz-custom.ini
environment:
- MYSQL_HOST=db
- MYSQL_PASSWORD=XXXXXXXX
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- NEXTCLOUD_TRUSTED_DOMAINS=XXXXXXXX
- REDIS_HOST=redis
- NEXTCLOUD_ADMIN_USER=XXXXXXXX
- NEXTCLOUD_ADMIN_PASSWORD=XXXXXXXX
depends_on:
- db
- redis
cron:
image: nextcloud:apache
restart: always
volumes:
- ./nextcloud:/var/www/html
entrypoint: /cron.sh
depends_on:
- db
- redis
I want to start expanding cron jobs to for example do preview building, calander sync etc. Everything is working like it should and every 5 min cron is working like it should (green light for background jobs Cron under basic settings).
Now the question is, were do I add extra cron rules/lines like for example:
0 0 * * 0 php -f /var/www/html/occ fulltextsearch:index
There is a cron.php
file in my mapped volume .nextcloud:/var/www/html
but when I look in to that is a full file with loads of text.
GNU nano 2.9.3 cron.php
// We only ask for jobs for 14 minutes, because after 5 minutes the next
// system cron task should spawn and we want to have at most three
// cron jobs running in parallel.
$endTime = time() + 14 * 60;
$executedJobs = [];
while ($job = $jobList->getNext()) {
if (isset($executedJobs[$job->getId()])) {
$jobList->unlockJob($job);
break;
}
$job->execute($jobList, $logger);
// clean up after unclean jobs
\OC_Util::tearDownFS();
$jobList->setLastJob($job);
$executedJobs[$job->getId()] = true;
unset($job);
if (time() > $endTime) {
break;
}
}
} else {
// We call cron.php from some website
if ($appMode === 'cron') {
// Cron is cron :-P
OC_JSON::error(['data' => ['message' => 'Backgroundjobs are using system cron!']]);
} else {
// Work and success :-)
$jobList = \OC::$server->getJobList();
$job = $jobList->getNext();
if ($job != null) {
$job->execute($jobList, $logger);
$jobList->setLastJob($job);
}
OC_JSON::success();
}
}
// Log the successful cron execution
$config->setAppValue('core', 'lastcron', time());
exit();
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
} catch (Error $ex) {
\OC::$server->getLogger()->logException($ex, ['app' => 'cron']);
}
Or do I need to add - ./mycronfile:/var/spool/cron/crontabs/www-data
to my compose file like suggested in:
and then add the lines i want to that new file?
Does the base line in that file: */5 * * * * php -f /var/www/html/cron.php
call the cron.php file i was referring to? So if for example i want to change the interval I change /5 to /15 for a 15 min interval?
If you need more info, please met me know!