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.
68 lines
No EOL
2.2 KiB
Docker
68 lines
No EOL
2.2 KiB
Docker
FROM ghcr.io/linuxserver/baseimage-alpine:edge
|
|
|
|
###############################################################################
|
|
# YTDL-SUB INSTALL
|
|
|
|
# For phantomjs
|
|
ENV OPENSSL_CONF="/etc/ssl"
|
|
# For downloading thumbnails
|
|
ENV SSL_CERT_DIR="/etc/ssl/certs/"
|
|
|
|
COPY root/ /
|
|
RUN mkdir -p /config && \
|
|
apk update --no-cache && \
|
|
apk upgrade --no-cache && \
|
|
apk add --no-cache --repository=http://dl-3.alpinelinux.org/alpine/edge/main/ \
|
|
vim \
|
|
g++ \
|
|
nano \
|
|
make \
|
|
libffi-dev \
|
|
"python3>=3.10" \
|
|
py3-pip \
|
|
fontconfig \
|
|
py3-setuptools && \
|
|
# Install edge ffmpeg and aria2 from community, ensure they are properly installed
|
|
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
|
"ffmpeg>5.1" \
|
|
"aria2>=1.36.0" && \
|
|
ffmpeg -version && \
|
|
aria2c --version && \
|
|
# Install phantomjs if using x86_64, ensure it is properly installed
|
|
if [[ $(uname -m) == "x86_64" ]]; then \
|
|
apk add --no-cache gcompat && \
|
|
cd /usr/share && \
|
|
curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | tar xj && \
|
|
mv /usr/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs phantomjs && \
|
|
rm -rf /usr/share/phantomjs-2.1.1-linux-x86_64 && \
|
|
ln -s /usr/share/phantomjs /usr/bin/phantomjs && \
|
|
echo "Phantom JS version:" && \
|
|
phantomjs --version && \
|
|
cd -; \
|
|
fi && \
|
|
echo "hi" && \
|
|
# Install ytdl-sub, ensure it is installed properly
|
|
python3 -m pip install --break-system-packages --no-cache-dir ytdl_sub-*.whl && \
|
|
ytdl-sub -h && \
|
|
# Delete unneeded packages after install
|
|
rm ytdl_sub-*.whl && \
|
|
apk del \
|
|
g++ \
|
|
make \
|
|
libffi-dev \
|
|
py3-pip \
|
|
py3-setuptools
|
|
|
|
###############################################################################
|
|
# CONTAINER CONFIGS
|
|
|
|
ENV EDITOR="nano" \
|
|
HOME="/config" \
|
|
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
|
|
DEFAULT_WORKSPACE=/config \
|
|
CRON_SCRIPT="/config/cron" \
|
|
CRON_WRAPPER_SCRIPT="/config/.cron_wrapper" \
|
|
LOGS_TO_STDOUT=/config/.cron.log \
|
|
LSIO_FIRST_PARTY=false
|
|
|
|
VOLUME /config |