Skip to content

Commit

Permalink
Merge pull request #97 from monlor/test
Browse files Browse the repository at this point in the history
feat: 🎸 小雅alist定时更新修改为随机时间
  • Loading branch information
monlor authored Jun 11, 2024
2 parents 097a34f + 72c7f14 commit 64f15d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion alist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ docker run -d -p 5678:80 -p 2345:2345 -p 2346:2346 --restart=unless-stopped --na

`AUTO_CLEAR_ENABLED`: 自动清理阿里云云盘的文件,true/false,默认false

`AUTO_CLEAR_INTERVAL`: 自动清理间隔,单位分钟,默认1分钟
`AUTO_CLEAR_INTERVAL`: 自动清理间隔,单位分钟,默认10分钟
7 changes: 5 additions & 2 deletions alist/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ crontabs=""

if [ "${AUTO_UPDATE_ENABLED:=false}" = "true" ]; then
echo "启动定时更新定时任务..."
crontabs="0 3 * * * /data.sh update"
# 随机生成一个时间,避免给服务器造成压力
random_min=$(shuf -i 0-59 -n 1)
random_hour=$(shuf -i 2-6 -n 1)
crontabs="${random_min} ${random_hour} * * * /data.sh update"
fi

if [ "${AUTO_CLEAR_ENABLED:=false}" = "true" ]; then
echo "启动定时清理定时任务..."
crontabs="${crontabs}\n*/${AUTO_CLEAR_INTERVAL:=1} * * * * /clear.sh"
crontabs="${crontabs}\n*/${AUTO_CLEAR_INTERVAL:=10} * * * * /clear.sh"
fi

if [ -n "${crontabs}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ALIYUN_FOLDER_ID=
AUTO_UPDATE_ENABLED=true
# 自动清理阿里云盘
AUTO_CLEAR_ENABLED=true
# 阿里云盘自动清理间隔,单位分钟,默认1分钟
# 阿里云盘自动清理间隔,单位分钟,默认10分钟
AUTO_CLEAR_INTERVAL=
# pikpak 账号,用来观看小雅中pikpak分享给你的资源,格式:`[email protected]:aaadds`
PIKPAK_USER=
Expand Down

0 comments on commit 64f15d7

Please sign in to comment.