Cron mimic for Preview Generator app for Nextcloud docker container
1.4K
This is a python script that makes scheduled command calls (occ preview:generate-all or occ preview:pre-generate) for generating previews for Preview Generator.
If you're updating your Nextcloud docker container by pulling a new image, you cannot setup the cronjob command as stated in the documentation of the Preview Generator, since the cronjob file will be overridden. So this docker image is mimicking the cronjob and running the command.
The tag latest is multi-arch, so you can use it for any architecture.
IMPORTANT: you must create the following file named config.yml and place it in a folder, that will be binded to a volume. Otherwise you cannot use this docker image.
general_settings:
## MANDATORY. Name of your nextcloud docker container. It most probably should be: nextcloud
nextcloud_container_name: <INSERT YOUR NEXTCLOUD CONTAINER NAME HERE>
## OPTIONAL. Defaults to true if deleted. If true is selected then the command "occ preview:generate-all" will be used. If set to false, then "occ preview:pre-generate" will be used
generate_all: <true or false>
## DELETE THE ONE YOU DON'T NEED. This is the schedule when you want the script to run and call the Preview Generator commands
backup_schedule:
## DELETE IF NOT NEEDED
weekly:
## available values are MON, TUE, WED, THU, FRI, SAT, SUN.
day: <INPUT DAY HERE>
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
## DELETE IF NOT NEEDED
daily:
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
## DELETE IF NOT NEEDED. This schedule will run the preview generation command, on the specified day on the last week of the current month
last_day_of_month:
## available values are MON, TUE, WED, THU, FRI, SAT, SUN.
day: <INPUT DAY HERE>
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
The config.yml can also be found here.
docker create \
--name=preview-generator-cron \
-d \
-e TZ=Europe/London \
-v /path/to/your/yaml/config/file:/yaml \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart unless-stopped \
dokeraj/preview-generator-cron:latest
| flag | Function |
|---|---|
-e TZ=Europe/London | Mandatory. Set it to your timezone. Note: If not set properly, the scheduled backup/update will not be ran at the specified time! |
-v /path/to/your/yaml/config/file:/yaml | Mandatory. This bind should point to where you have placed your config.yml file, so Preview-Generator-Cron can read it on startup. |
-v /var/run/docker.sock:/var/run/docker.sock | Mandatory. This bind should be left as it is - it helps the docker container to get access to docker server environment and monitor for events. |
Source code can be found here: Preview Generator Cron
Content type
Image
Digest
Size
21.7 MB
Last updated
over 4 years ago
docker pull dokeraj/preview-generator-cron