Skip to content

Commit

Permalink
feat: cron integrate xiaoya script
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed Feb 20, 2024
1 parent 1f15733 commit da59953
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 95 deletions.
4 changes: 1 addition & 3 deletions cron/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ ENV TZ=Asia/Shanghai

RUN set -ex && \
apk add --no-cache \
jq \
bash \
curl \
docker \
s6-overlay \
tzdata \
sqlite && \
tzdata && \
rm -rf \
/var/cache/apk/* \
/tmp/*
Expand Down
87 changes: 0 additions & 87 deletions cron/rootfs/app/sync_emby_config.sh

This file was deleted.

33 changes: 28 additions & 5 deletions cron/rootfs/etc/s6-overlay/s6-rc.d/init-config/run
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

Green="\033[32m"
Red="\033[31m"
Yellow='\033[33m'
Font="\033[0m"
INFO="[${Green}INFO${Font}]"
ERROR="[${Red}ERROR${Font}]"
WARN="[${Yellow}WARN${Font}]"
function INFO() {
echo -e "${INFO} ${1}"
}
function ERROR() {
echo -e "${ERROR} ${1}"
}
function WARN() {
echo -e "${WARN} ${1}"
}

if [ ! -d /app ]; then
mkdir /app
fi
cd /app || exit

crontab -r

echo "${CRON} bash /app/sync_emby_config.sh ${EMBY} ${RESILIO} >> /config/cron.log 2>&1" > /app/cronjob.list
echo "${CRON} bash /app/sync_emby_config.sh ${EMBY} ${RESILIO} >> /config/cron.log 2>&1"
echo "bash /app/sync_emby_config.sh ${EMBY} ${RESILIO}" > /app/command.sh
CRON_COMMAND="bash -c \"\$(curl http://docker.xiaoya.pro/sync_emby_config.sh)\" -s /media /etc/xiaoya ${EMBY} ${RESILIO}"

echo -e "${CRON} ${CRON_COMMAND} >> /config/cron.log 2>&1" > /app/cronjob.list
echo -e "${CRON_COMMAND}" > /app/command.sh

INFO "$(cat /app/cronjob.list)"

if crontab /app/cronjob.list; then
echo "定时任务添加成功"
INFO "定时任务添加成功"
else
echo "定时任务添加失败"
ERROR "定时任务添加失败"
exit 1
fi

0 comments on commit da59953

Please sign in to comment.