Automating Downloads — ytdl-sub documentation (../../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b) (../../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b) (../../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b) (../../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b) (../../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2) (../../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2) (../../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2) (../../_static/pygments.css?v=a746c00c) (../../_static/styles/sphinx-book-theme.css?v=384b581d) (../../_static/copybutton.css?v=76b2166b) (../../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7) (/_/static/css/badge_only.css) (../../_static/custom.css) (../../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b) (../../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b) (Index) (../../genindex.html) (Search) (../../search.html) (Basic Configuration) (first_config.html) (Initial Download) (first_download.html) (/_/static/css/readthedocs-doc-embed.css) Skip to main content Back to top (Search...) Ctrl +K (../../index.html) ytdl-sub documentation (https://github.com/jmbannon/ytdl-sub) GitHub (https://discord.gg/v8j9RAHb4k) (Discord) Search Ctrl +K (../../introduction.html) What is ytdl-sub? (../index.html) Guides (../install/index.html) Install by Platform (../install/docker.html) Docker (../install/linux.html) Linux (../install/unraid.html) Unraid (../install/windows.html) Windows (../install/agnostic.html) Environment Agnostic (index.html) Getting Started (first_sub.html) Initial Subscription (first_download.html) Initial Download Automating Downloads (first_config.html) Basic Configuration (advanced_configuration.html) Advanced Configuration (examples.html) Using Example Configs (../development/index.html) Development and Contributing (../../prebuilt_presets/index.html) Prebuilt Presets (../../prebuilt_presets/helpers.html) Helper Presets (../../prebuilt_presets/tv_shows.html) TV Show Presets (../../prebuilt_presets/music.html) Music Presets (../../usage.html) Usage (../../config_reference/index.html) Reference (../../config_reference/config_yaml.html) Configuration File (../../config_reference/subscriptions_yaml.html) Subscriptions File (../../config_reference/plugins.html) Plugins (../../config_reference/scripting/index.html) Scripting (../../config_reference/scripting/entry_variables.html) Entry Variables (../../config_reference/scripting/static_variables.html) Static Variables (../../config_reference/scripting/scripting_functions.html) Scripting Functions (../../config_reference/scripting/scripting_types.html) Scripting Types (../../config_reference/prebuilt_presets/index.html) Prebuilt Preset Reference (../../config_reference/prebuilt_presets/common.html) Common (../../config_reference/prebuilt_presets/tv_show.html) TV Show (../../config_reference/prebuilt_presets/music.html) Music (../../faq/index.html) FAQ (../../deprecation_notices.html) Deprecation Notices v: latest Versions (https://ytdl-sub.readthedocs.io/en/latest/guides/getting_started/automating_downloads.html) latest (https://ytdl-sub.readthedocs.io/en/v0.2.0/guides/getting_started/automating_downloads.html) v0.2.0 On Read the Docs (//readthedocs.org/projects/ytdl-sub/) Project Home (//readthedocs.org/projects/ytdl-sub/builds/) Builds (//readthedocs.org/projects/ytdl-sub/downloads/) Downloads On GitHub (https://github.com/jmbannon/ytdl-sub/blob/master/docs/source/guides/getting_started/automating_downloads.rst) View (https://github.com/jmbannon/ytdl-sub/edit/master/docs/source/guides/getting_started/automating_downloads.rst) Edit Search (Search docs) Hosted by (https://readthedocs.org) Read the Docs · (https://docs.readthedocs.io/page/privacy-policy.html) Privacy Policy (../../_sources/guides/getting_started/automating_downloads.rst) .rst .pdf Automating Downloads Contents Docker and Unraid Linux Windows Automating Downloads(Link to this heading) # One of the key capabilities of ytdl-sub is how well it runs without user input, but to take advantage of this you must set up scheduling to execute the commands at some interval. How you set up this scheduling depends on which version of ytdl-sub you downloaded. Guide for Docker and Unraid Containers Guide for Linux Guide for Windows Docker and Unraid(Link to this heading) # GUI Image The script that will execute automatically is located at /config/ytdl-sub-configs/run-cron . Access your container at (http://localhost:8443/) http://localhost:8443/ , then in the GUI terminal run these commands: echo '#!/bin/bash' > /config/ytdl-sub-configs/run_cron echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /config/ytdl-sub-configs/run_cron echo "echo 'Cron started, running ytdl-sub...'" >> /config/ytdl-sub-configs/run_cron echo "cd /config/ytdl-sub-configs" >> /config/ytdl-sub-configs/run_cron echo "ytdl-sub --config=config.yaml sub subscriptions.yaml" >> /config/ytdl-sub-configs/run_cron chmod +x /config/ytdl-sub-configs/run_cron chown abc:abc /config/ytdl-sub-configs/run_cron Copy to clipboard You can test the newly created script by running: /config/ytdl-sub-configs/run_cron Copy to clipboard To create the cron definition, run the following command: echo "# min hour day month weekday command" > /config/crontabs/abc echo " 0 */6 * * * /config/ytdl-sub-configs/run_cron" >> /config/crontabs/abc Copy to clipboard This will run the script every 6 hours. To run every hour, change */6 to */1 , or to run once a day, change the same value to the hour (in 24hr format) that you want it to run at. See the (https://man7.org/linux/man-pages/man5/crontab.5.html#EXAMPLE_CRON_FILE) cron tab manpage for more options. Headless Image The first step is to ensure you have (https://github.com/linuxserver/docker-mods/tree/universal-cron) LinuxServer’s Universal Cron mod enabled via the environment variable. For the GUI image, this is already included (no need to add it). services : ytdl-sub : image : ghcr.io/jmbannon/ytdl-sub:latest container_name : ytdl-sub environment : - PUID=1000 - PGID=1000 - TZ=America/Los_Angeles - DOCKER_MODS=linuxserver/mods:universal-cron # <-- Make sure you have this! volumes : # ensure directories have user permissions - :/config - :/tv_shows restart : unless-stopped Copy to clipboard This line will tell your container to install and enable cron on start. If you had to add this line, you will need to restart your container. docker compose restart Copy to clipboard The script that will execute automatically is located at /config/run-cron . Access your container from the terminal by running: docker exec -itu abc ytdl-sub /bin/bash Copy to clipboard then in the terminal run these commands: echo '#!/bin/bash' > /config/ytdl-sub-configs/run_cron echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /config/ytdl-sub-configs/run_cron echo "echo 'Cron started, running ytdl-sub...'" >> /config/ytdl-sub-configs/run_cron echo "cd /config/ytdl-sub-configs" >> /config/ytdl-sub-configs/run_cron echo "ytdl-sub --config=config.yaml sub subscriptions.yaml" >> /config/ytdl-sub-configs/run_cron chmod +x /config/ytdl-sub-configs/run_cron chown abc:abc /config/ytdl-sub-configs/run_cron Copy to clipboard You can test the newly created script by running: / config / run_cron Copy to clipboard To create the cron definition, run the following command: echo "# min hour day month weekday command" > /config/crontabs/abc echo " 0 */6 * * * /config/run_cron" >> /config/crontabs/abc Copy to clipboard This will run the script every 6 hours. To run every hour, change */6 to */1 , or to run once a day, change the same value to the hour (in 24hr format) that you want it to run at. See the (https://man7.org/linux/man-pages/man5/crontab.5.html#EXAMPLE_CRON_FILE) cron tab manpage for more options. Linux(Link to this heading) # crontab -e 0 */6 * * * /config/run_cron Copy to clipboard Windows(Link to this heading) # To be tested (please contact code owner or join the discord server if you can test this out for us) ytdl-sub . exe - -config \ path \ to \ config \ config . yaml sub \ path \ to \ config \ subscriptions . yaml Copy to clipboard (first_download.html) (previous page) previous Initial Download (first_config.html) (next page) next Basic Configuration Contents Docker and Unraid Linux Windows By Jesse Bannon © Copyright 2024, Jesse Bannon.