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.
91 lines
No EOL
3.3 KiB
Text
91 lines
No EOL
3.3 KiB
Text
FROM lscr.io/linuxserver/code-server:4.18.0-ls181
|
|
|
|
# For phantomjs
|
|
ENV OPENSSL_CONF="/etc/ssl"
|
|
# For downloading thumbnails
|
|
ENV SSL_CERT_DIR="/etc/ssl/certs/"
|
|
|
|
###############################################################################
|
|
# YTDL-SUB INSTALL
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
COPY root/ /
|
|
RUN mkdir -p /config && \
|
|
apt-get -y update && \
|
|
apt-get -y upgrade && \
|
|
apt-get install --no-install-recommends -y \
|
|
software-properties-common && \
|
|
apt-get -y update && \
|
|
apt-get -y upgrade && \
|
|
apt-get install --no-install-recommends -y \
|
|
vim \
|
|
g++ \
|
|
nano \
|
|
make \
|
|
python3.10-dev \
|
|
python3-pip \
|
|
fontconfig \
|
|
xz-utils \
|
|
bzip2 \
|
|
aria2 \
|
|
python3-venv && \
|
|
if [[ $(uname -m) == "x86_64" ]]; then \
|
|
curl -L -o ffmpeg.tar.gz https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz && \
|
|
tar -xf ffmpeg.tar.gz && \
|
|
chmod +x ffmpeg-master-latest-linux64-gpl/bin/ffmpeg && \
|
|
chmod +x ffmpeg-master-latest-linux64-gpl/bin/ffprobe && \
|
|
mv ffmpeg-master-latest-linux64-gpl/bin/ffmpeg /usr/bin/ffmpeg && \
|
|
mv ffmpeg-master-latest-linux64-gpl/bin/ffprobe /usr/bin/ffprobe && \
|
|
rm ffmpeg.tar.gz && \
|
|
rm -rf ffmpeg-master-latest-linux64-gpl/ ; \
|
|
else \
|
|
curl -L -o ffmpeg.tar.gz https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz && \
|
|
tar -xf ffmpeg.tar.gz && \
|
|
chmod +x ffmpeg-master-latest-linuxarm64-gpl/bin/ffmpeg && \
|
|
chmod +x ffmpeg-master-latest-linuxarm64-gpl/bin/ffprobe && \
|
|
mv ffmpeg-master-latest-linuxarm64-gpl/bin/ffmpeg /usr/bin/ffmpeg && \
|
|
mv ffmpeg-master-latest-linuxarm64-gpl/bin/ffprobe /usr/bin/ffprobe && \
|
|
rm ffmpeg.tar.gz && \
|
|
rm -rf ffmpeg-master-latest-linuxarm64-gpl/ ; \
|
|
fi && \
|
|
# Ensure ffmpeg is installed
|
|
ffmpeg -version && \
|
|
# Install phantomjs if using x86_64, ensure it is properly installed
|
|
if [[ $(uname -m) == "x86_64" ]]; then \
|
|
curl -L -o phantomjs.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
|
|
tar -xvf phantomjs.tar.bz2 && \
|
|
mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs && \
|
|
rm -rf phantomjs-2.1.1-linux-x86_64/ && \
|
|
rm phantomjs.tar.bz2 && \
|
|
echo "Phantom JS version:" && \
|
|
phantomjs --version ; \
|
|
fi && \
|
|
# Install ytdl-sub, ensure it is installed properly
|
|
pip install --no-cache-dir ytdl_sub-*.whl && \
|
|
ytdl-sub -h && \
|
|
# Delete unneeded packages after install
|
|
rm ytdl_sub-*.whl && \
|
|
apt-get remove -y \
|
|
g++ \
|
|
make \
|
|
xz-utils \
|
|
bzip2 \
|
|
python3.10-dev \
|
|
python3-venv && \
|
|
apt-get autoremove -y && \
|
|
apt-get purge -y --auto-remove && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
###############################################################################
|
|
# CONTAINER CONFIGS
|
|
|
|
ENV EDITOR="nano" \
|
|
HOME="/config" \
|
|
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
|
|
DEFAULT_WORKSPACE=/config/ytdl-sub-configs \
|
|
CRON_SCRIPT="/config/ytdl-sub-configs/cron" \
|
|
CRON_WRAPPER_SCRIPT="/config/ytdl-sub-configs/.cron_wrapper" \
|
|
LOGS_TO_STDOUT=/config/ytdl-sub-configs/.cron.log \
|
|
LSIO_FIRST_PARTY=false
|
|
|
|
VOLUME /config |