Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed: how to add a cron task? #361

Closed
MaxenceG2M opened this issue Jun 5, 2018 · 5 comments
Closed

Help needed: how to add a cron task? #361

MaxenceG2M opened this issue Jun 5, 2018 · 5 comments

Comments

@MaxenceG2M
Copy link

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 !

@pierreozoux
Copy link
Member

Check the example folder

@MaxenceG2M
Copy link
Author

MaxenceG2M commented Jun 6, 2018

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...

@SnowMB
Copy link
Contributor

SnowMB commented Jun 11, 2018

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

@J0WI
Copy link
Contributor

J0WI commented Aug 16, 2018

I would recommend to add */10 * * * * docker exec -u www-data <my-nextcloud> <my-cmd> or an equivalent systemd timer on your host.

@MaxenceG2M
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants