First of all my apolagies for whom might find that the answer to my question is already out there, and that I simply have not looked hard enough… I can assure you I have spend numerous hours looking for a solution, without any luck.
I am running official Nextcloud 29.0.0, Chart Version:2.0.2 on TrueNAS-SCALE-23.10.2.
Nextcloud is running just fine, using an “SMB/CIFS” “External storage”. However I am looking into implementing some cron jobs, and have no clue how to do so. Cron does seem to be running, as I have selected it when installing the app.
Can anyone assist me in adding a Nextcloud cron job? I did find some documentation using docker, but docker commands are not recognized?
To see if cron is running properley, click on your photo / icon at the top right corner of your Nextcloud webpage. From there, click “Administration settings”, and a security and setup warnings page will be displayed, including commenting on your cron.
Nextcloud is supposed to enable the standard job (maintenance of stuff) automatically if you select cron (Recommended). They used to have a bug in the IX app for this but it was resolved long ago. But he does have the green tick. If you want other cron jobs other than the background nextcloud created one (which OP says he does), I find it much easier to schedule outside of Nextcloud, i.e., simply have it run the command(s) or script inside the container. More visible, etc. So, I still use the UI for that. YMMV.
But the OP mentions docker commands, still indicating he wants to outside of the container. Docker is not there, like virtually all “guides”, out of date. The way you do that is like this (example):
Hello @sfatula, took a while before I found the time to test it. I assume the problem is that Truenas has 3 Nextcloud pods running.
Error from server (NotFound): pods "nextcloud-redis-74444979dc-jgktt\nnextcloud-postgres-6779b848-sbw8b\nnextcloud-6d4b74cd88-4qs9d" not found
Also running the command with the pod name entered manually gives me the following.
# Linux truenas 6.1.74-production+truenas #2 SMP PREEMPT_DYNAMIC Wed Feb 21 20:30:38 UTC 2024 x86_64
TrueNAS (c) 2009-2024, iXsystems, Inc.
All rights reserved.
TrueNAS code is released under the modified BSD license with some
files copyrighted by (c) iXsystems, Inc.
For more information, documentation, help or support, go here:
http://truenas.com
Welcome to TrueNAS
Last login: Mon May 13 12:56:20 CEST 2024 on pts/117
# k3s kubectl exec -n ix-nextcloud --stdin --tty $nextcloud-6d4b74cd88-4qs9d -- su -s /bin/bash www-data -c php occ preview:generate-all
FATA[0000] exec: "kubectl": cannot run executable found relative to current directory
#
# k3s kubectl exec -n ix-nextcloud --stdin --tty $nextcloud-6d4b74cd88-4qs9d -- su -s /bin/bash www-data -c php /var/www/html/occ preview:generate-all
FATA[0000] exec: "kubectl": cannot run executable found relative to current directory
#