Compare commits
3 commits
master
...
j/simplify
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c69c18f623 | ||
|
|
c2383614f3 | ||
|
|
94db90f113 |
11 changed files with 66 additions and 27 deletions
|
|
@ -55,6 +55,8 @@ RUN mkdir -p /config && \
|
||||||
# CONTAINER CONFIGS
|
# CONTAINER CONFIGS
|
||||||
|
|
||||||
ENV EDITOR="nano" \
|
ENV EDITOR="nano" \
|
||||||
HOME="/config"
|
HOME="/config" \
|
||||||
|
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
|
||||||
|
LOGS_TO_STDOUT=/config/cron_logs.txt
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
@ -81,7 +81,8 @@ RUN mkdir -p /config && \
|
||||||
ENV YTDL_SUB_TYPE="gui" \
|
ENV YTDL_SUB_TYPE="gui" \
|
||||||
EDITOR="nano" \
|
EDITOR="nano" \
|
||||||
HOME="/config" \
|
HOME="/config" \
|
||||||
DOCKER_MODS=linuxserver/mods:universal-cron \
|
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
|
||||||
|
LOGS_TO_STDOUT=/config/ytdl-sub-configs/cron_logs.txt \
|
||||||
DEFAULT_WORKSPACE=/config/ytdl-sub-configs
|
DEFAULT_WORKSPACE=/config/ytdl-sub-configs
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
@ -81,6 +81,8 @@ RUN mkdir -p /config && \
|
||||||
# CONTAINER CONFIGS
|
# CONTAINER CONFIGS
|
||||||
|
|
||||||
ENV EDITOR="nano" \
|
ENV EDITOR="nano" \
|
||||||
HOME="/config"
|
HOME="/config" \
|
||||||
|
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
|
||||||
|
LOGS_TO_STDOUT=/config/cron_logs.txt
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
@ -5,19 +5,56 @@ if [ "$YTDL_SUB_TYPE" != "gui" ] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking ytdl-sub-gui defaults..."
|
# always create the config dir with empty cron logs
|
||||||
|
mkdir -p /config/ytdl-sub-configs
|
||||||
|
echo "" > /config/ytdl-sub-configs/cron_logs.txt
|
||||||
|
|
||||||
|
echo "[ytdl-sub-init] Checking defaults..."
|
||||||
|
|
||||||
# copy config
|
# copy config
|
||||||
[[ ! -e /config/ytdl-sub-configs/config.yaml ]] && \
|
[[ ! -e /config/ytdl-sub-configs/config.yaml ]] && \
|
||||||
mkdir -p /config/ytdl-sub-configs && \
|
|
||||||
cp /defaults/config.yaml /config/ytdl-sub-configs/config.yaml
|
cp /defaults/config.yaml /config/ytdl-sub-configs/config.yaml
|
||||||
[[ ! -e /config/ytdl-sub-configs/subscriptions.yaml ]] && \
|
[[ ! -e /config/ytdl-sub-configs/subscriptions.yaml ]] && \
|
||||||
mkdir -p /config/ytdl-sub-configs && \
|
|
||||||
cp /defaults/subscriptions.yaml /config/ytdl-sub-configs/subscriptions.yaml
|
cp /defaults/subscriptions.yaml /config/ytdl-sub-configs/subscriptions.yaml
|
||||||
[[ ! -d /config/ytdl-sub-configs/examples ]] && \
|
[[ ! -d /config/ytdl-sub-configs/examples ]] && \
|
||||||
mkdir -p /config/ytdl-sub-configs/examples && \
|
mkdir -p /config/ytdl-sub-configs/examples && \
|
||||||
cp /defaults/examples/* /config/ytdl-sub-configs/examples
|
cp -r /defaults/examples/* /config/ytdl-sub-configs/examples
|
||||||
|
[[ ! -d /config/ytdl-sub-configs/cron_script ]] && \
|
||||||
|
cp /defaults/cron_script /config/ytdl-sub-configs/cron_script
|
||||||
|
chmod +x /config/ytdl-sub-configs/cron_script
|
||||||
|
|
||||||
# permissions
|
# permissions
|
||||||
chown -R ${PUID:-abc}:${PGID:-abc} \
|
chown -R ${PUID:-abc}:${PGID:-abc} \
|
||||||
/config
|
/config
|
||||||
|
|
||||||
|
if [ -n "$CRON_SCHEDULE" ] ; then
|
||||||
|
# copy cron wrapper over
|
||||||
|
cp /defaults/cron_wrapper.gui /opt/cron_wrapper
|
||||||
|
chmod +x /opt/cron_wrapper
|
||||||
|
chown abc:abc /opt/cron_wrapper
|
||||||
|
|
||||||
|
# execute cron wrapper in the crontab file
|
||||||
|
echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > /config/crontabs/abc
|
||||||
|
echo "" >> /config/crontabs/abc
|
||||||
|
echo "# min hour day month weekday command" >> /config/crontabs/abc
|
||||||
|
echo " ${CRON_SCHEDULE} /opt/cron_wrapper" >> /config/crontabs/abc
|
||||||
|
|
||||||
|
# restart cron
|
||||||
|
/etc/init.d/cron reload
|
||||||
|
|
||||||
|
# check cron
|
||||||
|
crontab -u abc /config/crontabs/abc
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
echo "[ytdl-sub-init] Cron schedule is successfully set to ${CRON_SCHEDULE}"
|
||||||
|
if [ -n "$CRON_RUN_ON_START" ] ; then
|
||||||
|
# Run cron script on start, logs get emitted to docker so do not write to cron logs
|
||||||
|
echo "[ytdl-sub-init] Cron on start enabled, starting"
|
||||||
|
sudo -b -u abc bash -c "cd /config/ytdl-sub-configs && ./cron_script"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[ytdl-sub-init] Cron schedule is invalid, disabling"
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ if [ "$YTDL_SUB_TYPE" == "gui" ] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking ytdl-sub defaults..."
|
# always create the config dir with empty cron logs
|
||||||
|
mkdir -p /config
|
||||||
|
echo "" > /config/cron_logs.txt
|
||||||
|
|
||||||
|
echo "[ytdl-sub-init] Checking defaults..."
|
||||||
|
|
||||||
# copy config
|
# copy config
|
||||||
[[ ! -e /config/config.yaml ]] && \
|
[[ ! -e /config/config.yaml ]] && \
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,2 @@
|
||||||
# Bare-bones config. Here are some useful links to get started:
|
|
||||||
# Walk-through Guide: https://ytdl-sub.readthedocs.io/en/latest/guides/index.html
|
|
||||||
# Config Examples: https://github.com/jmbannon/ytdl-sub/tree/master/examples
|
|
||||||
# Prebuilt Presets: https://ytdl-sub.readthedocs.io/en/latest/presets.html
|
|
||||||
# Config Reference: https://ytdl-sub.readthedocs.io/en/latest/config_reference/index.html
|
|
||||||
#
|
|
||||||
# The subscriptions in `subscriptions.yaml` uses prebuilt presets which do not require
|
|
||||||
# any additions to this config. They can be downloaded using the command:
|
|
||||||
#
|
|
||||||
# ytdl-sub --config config.yaml sub subscriptions.yaml
|
|
||||||
#
|
|
||||||
# Or dry-ran with:
|
|
||||||
#
|
|
||||||
# ytdl-sub --dry-run --config config.yaml sub subscriptions.yaml
|
|
||||||
#
|
|
||||||
# See the documentation above on how to build your own custom presets.
|
|
||||||
#
|
|
||||||
configuration:
|
configuration:
|
||||||
working_directory: ".ytdl-sub-working-directory"
|
working_directory: ".ytdl-sub-working-directory"
|
||||||
|
|
|
||||||
2
docker/root/defaults/cron_script
Normal file
2
docker/root/defaults/cron_script
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
echo "Running cron_script"
|
||||||
|
ytdl-sub --log-level info --config config.yaml sub subscriptions.yaml
|
||||||
3
docker/root/defaults/cron_wrapper.gui
Normal file
3
docker/root/defaults/cron_wrapper.gui
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd /config/ytdl-sub-configs
|
||||||
|
bash ./cron_script | tee -a ./cron_logs.txt
|
||||||
3
docker/root/defaults/cron_wrapper.headless
Normal file
3
docker/root/defaults/cron_wrapper.headless
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd /config
|
||||||
|
bash ./cron_script | tee -a ./cron_logs.txt
|
||||||
|
|
@ -6,6 +6,8 @@ services:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- TZ=America/Los_Angeles
|
- TZ=America/Los_Angeles
|
||||||
|
- CRON_SCHEDULE=* * * * * */1
|
||||||
|
- CRON_RUN_ON_START=True
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/ytdl-sub-gui:/config
|
- ./volumes/ytdl-sub-gui:/config
|
||||||
ports:
|
ports:
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
__pypi_version__ = "2023.10.22.post3"
|
__pypi_version__ = "2024.06.19.post2"
|
||||||
__local_version__ = "2023.10.22+bfba4f0"
|
__local_version__ = "2024.06.19+c2383614"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue