Drastically simplifies setting up cron within ytdl-sub. Below is the documentation which is available in readthedocs, and a section on how to migrate from the old way to this.
## New Cron Documentation
Cron is preconfigured in every ytdl-sub docker container. Enable by adding the following ENV variables to your docker setup.
```
services:
ytdl-sub:
environment:
- CRON_SCHEDULE="0 */6 * * *"
- CRON_RUN_ON_START=false
```
- CRON_SCHEDULE follows the standard [cron scheduling syntax](https://crontab.guru/#0_*/6_*_*_*). The above value will run the script once every 6 hours.
- CRON_RUN_ON_START toggles whether to run your cron script on container start.
The cron script will reside in the main directory with the file name `cron`. Cron logs should show when viewing the Docker logs.
## Migrating Existing Cron Setup
Containers' cron files will remain intact until you add the `CRON_SCHEDULE` variable. Once you add that with your preferred schedule, it will write that value to /config/crontabs/abc and create a new file `cron` within your working directory. Simply copy everything from your existing `run_cron` script into `cron`.
If you have the ENV variable `DOCKER_MODS` in your docker-compose, remove it. It is now included by default. Not removing this will prevent cron logs from showing in your docker container logs.
58 lines
1.4 KiB
ReStructuredText
58 lines
1.4 KiB
ReStructuredText
Automating Downloads
|
|
====================
|
|
|
|
:ref:`Guide for Docker and Unraid Containers <guides/getting_started/automating_downloads:docker and unraid>`
|
|
|
|
:ref:`Guide for Linux <guides/getting_started/automating_downloads:linux>`
|
|
|
|
:ref:`Guide for Windows <guides/getting_started/automating_downloads:windows>`
|
|
|
|
.. _cron scheduling syntax: https://crontab.guru/#0_*/6_*_*_*
|
|
|
|
.. _docker-unraid-setup:
|
|
|
|
Docker and Unraid
|
|
-----------------
|
|
|
|
Cron is preconfigured in every ytdl-sub docker container. Enable by adding the following
|
|
ENV variables to your docker setup.
|
|
|
|
.. code-block:: yaml
|
|
|
|
services:
|
|
ytdl-sub:
|
|
environment:
|
|
- CRON_SCHEDULE="0 */6 * * *"
|
|
- CRON_RUN_ON_START=false
|
|
|
|
|
|
- ``CRON_SCHEDULE`` follows the standard `cron scheduling syntax`_. The above value will run the script once every 6 hours.
|
|
- ``CRON_RUN_ON_START`` toggles whether to run your cron script on container start.
|
|
|
|
The cron script will reside in the main directory with the file name ``cron``.
|
|
Cron logs should show when viewing the Docker logs.
|
|
|
|
|
|
.. _linux-setup:
|
|
|
|
Linux
|
|
-----
|
|
Must configure crontab manually, like so:
|
|
|
|
.. code-block:: shell
|
|
|
|
crontab -e
|
|
0 */6 * * * /config/run_cron
|
|
|
|
|
|
|
|
|
|
.. _windows-setup:
|
|
|
|
Windows
|
|
-------
|
|
To be tested (please contact code owner or join the discord server if you can test this out for us)
|
|
|
|
.. code-block:: powershell
|
|
|
|
ytdl-sub.exe --config \path\to\config\config.yaml sub \path\to\config\subscriptions.yaml
|