default cron script
This commit is contained in:
parent
94db90f113
commit
c2383614f3
5 changed files with 13 additions and 32 deletions
|
|
@ -7,6 +7,9 @@ fi
|
||||||
|
|
||||||
echo "Checking ytdl-sub-gui defaults..."
|
echo "Checking ytdl-sub-gui defaults..."
|
||||||
|
|
||||||
|
# clear the cron logs on start, always
|
||||||
|
echo > /config/ytdl-sub-configs/cron_logs.txt
|
||||||
|
|
||||||
# copy config
|
# copy config
|
||||||
[[ ! -e /config/ytdl-sub-configs/config.yaml ]] && \
|
[[ ! -e /config/ytdl-sub-configs/config.yaml ]] && \
|
||||||
mkdir -p /config/ytdl-sub-configs && \
|
mkdir -p /config/ytdl-sub-configs && \
|
||||||
|
|
@ -17,23 +20,17 @@ echo "Checking ytdl-sub-gui defaults..."
|
||||||
[[ ! -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 /defaults/examples/* /config/ytdl-sub-configs/examples
|
||||||
|
[[ ! -d /config/ytdl-sub-configs/cron_script ]] && \
|
||||||
|
mkdir -p /config/ytdl-sub-configs && \
|
||||||
|
cp /defaults/cron_script /config/ytdl-sub-configs/cron_script
|
||||||
|
|
||||||
if [ "$CRON_ENABLE" = true ] ; then
|
if [ -n "$CRON_SCHEDULE" ] ; then
|
||||||
|
|
||||||
# set cron schedule if not set
|
|
||||||
if [ -z "${CRON_SCHEDULE}" ] ; then
|
|
||||||
CRON_SCHEDULE="0 */6 * * *"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# put it into the crontab file
|
# put it into the crontab file
|
||||||
echo "# min hour day month weekday command" > /config/crontabs/abc
|
echo "# min hour day month weekday command" > /config/crontabs/abc
|
||||||
echo " ${CRON_SCHEDULE} /config/ytdl-sub-configs/cron_script | tee -a /config/ytdl-sub-configs/cron_logs.txt" >> /config/crontabs/abc
|
echo " ${CRON_SCHEDULE} /config/ytdl-sub-configs/cron_script | tee -a /config/ytdl-sub-configs/cron_logs.txt" >> /config/crontabs/abc
|
||||||
|
|
||||||
# clear the cron logs on start, always
|
|
||||||
echo > /config/ytdl-sub-configs/cron_logs.txt
|
|
||||||
|
|
||||||
# restart cron
|
# restart cron
|
||||||
/etc/init.d/cron restart
|
/etc/init.d/cron reload
|
||||||
|
|
||||||
# check cron
|
# check cron
|
||||||
crontab -u abc -l
|
crontab -u abc -l
|
||||||
|
|
@ -43,7 +40,7 @@ if [ "$CRON_ENABLE" = true ] ; then
|
||||||
echo "Cron schedule is successfully set to ${CRON_SCHEDULE}"
|
echo "Cron schedule is successfully set to ${CRON_SCHEDULE}"
|
||||||
if [ "$CRON_RUN_ON_START" = true ] ; then
|
if [ "$CRON_RUN_ON_START" = true ] ; then
|
||||||
# Run cron script on start
|
# Run cron script on start
|
||||||
/config/ytdl-sub-configs/cron_script | tee -a /config/ytdl-sub-configs/cron_logs.txt &
|
su - abc -c "/config/ytdl-sub-configs/cron_script | tee -a /config/ytdl-sub-configs/cron_logs.txt" &
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Cron schedule is invalid, disabling"
|
echo "Cron schedule is invalid, disabling"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -6,7 +6,6 @@ services:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- TZ=America/Los_Angeles
|
- TZ=America/Los_Angeles
|
||||||
- CRON_ENABLE=True
|
|
||||||
- CRON_SCHEDULE=* * * * */1
|
- CRON_SCHEDULE=* * * * */1
|
||||||
- CRON_RUN_ON_START=True
|
- CRON_RUN_ON_START=True
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
__pypi_version__ = "2024.06.18"
|
__pypi_version__ = "2024.06.19.post1"
|
||||||
__local_version__ = "2024.06.18+f7305ebf"
|
__local_version__ = "2024.06.19+94db90f1"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue