Hi here!
I want to add a cron task but I don't understand how to do...
For information, I want to use the Preview Generator application. (I have a lot of issues with Gallery, but it's another subject.)
Someone can help me?
Thanks !
Check the example folder
Thank @pierreozoux
Yeah I did it. Actually, I use the docker-compose example with maria-cron-redis).
So I have a cron container - the entrypoint is cron.sh:
#!/bin/sh
set -eu
exec busybox crond -f -l 0 -L /dev/stdout
This entrypoint use busybox that I don't know much. If I correctly understand, it's a way to have a tiny cron.
But I don't figure out how to add a task: there's no crontab or something...
In the example folder, there is a Dockerfile example with a supervisord.conf file who run the same cron.sh...
So, I'm a little lost and don't know how to start...
The crontab was already written when the dockerfile was build. It is already part of the image. If you want to append another cronjob, try making a derived dockerfile something like this (not tested):
FROM nextcloud:apache
RUN echo '*/10 * * * * ./occ preview:pre-generate' >> /var/spool/cron/crontabs/www-data
I would recommend to add */10 * * * * docker exec -u www-data <my-nextcloud> <my-cmd> or an equivalent systemd timer on your host.
Thanks @J0WI! That what I did and it's OK.
I think I don't understand correctly the cron container usage.
Thanks for your help!
Most helpful comment
I would recommend to add
*/10 * * * * docker exec -u www-data <my-nextcloud> <my-cmd>or an equivalent systemd timer on your host.