This commit is contained in:
Jesse Bannon 2025-03-15 13:44:47 -07:00
parent 35778b250c
commit d3e0d6908f
4 changed files with 22 additions and 7 deletions

View file

@ -13,9 +13,6 @@ echo "Starting ytdl-sub..."
mkdir -p "$DEFAULT_WORKSPACE/examples" && \
cp -r /defaults/examples/* "$DEFAULT_WORKSPACE/examples"
# always create cron log file
touch "$LOGS_TO_STDOUT"
# permissions
chown -R ${PUID:-abc}:${PGID:-abc} \
/config
@ -39,7 +36,24 @@ if [ "$CRON_SCHEDULE" != "" ] ; then
chown abc:abc "$CRON_SCRIPT"
crontab -u abc /config/crontabs/abc
CRON_SUCCESS=$?
if [ $CRON_SUCCESS -eq 0 ] ; then
echo "Cron enabled with schedule $CRON_SCHEDULE_CLEAN"
if [ "$CRON_RUN_ON_START" = true ] ; then
echo "Running cron script on start"
. "$CRON_WRAPPER_SCRIPT"
fi
else
echo "Error in CRON_SCHEDULE definition, disabling cron."
fi
else
echo "CRON_SCHEDULE not specified, disabling cron."
echo "# min hour day month weekday command" > /config/crontabs/abc
fi
echo "" >> /config/crontabs/abc
fi
# always create cron log file, after cron runs
# on start to not tail it again
echo "" > "$LOGS_TO_STDOUT"

View file

@ -1,4 +1,4 @@
echo "Beginning cron job..."
# Place your ytdl-sub command here
# ytdl-sub -h
# Place your ytdl-sub command(s) here.
# This script is executed in the same relative path as this file.

View file

@ -2,4 +2,4 @@
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
cd "$DEFAULT_WORKSPACE"
. "$CRON_SCRIPT" | tee "$LOGS_TO_STDOUT"
. "$CRON_SCRIPT" | tee -a "$LOGS_TO_STDOUT"

View file

@ -7,6 +7,7 @@ services:
- PGID=1000
- TZ=America/Los_Angeles
- CRON_SCHEDULE="*/1 * * * *"
- CRON_RUN_ON_START=false
volumes:
- ./volumes/ytdl-sub-gui:/config
ports: