-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·30 lines (24 loc) · 1.06 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
CRON_MINS=$((0 + RANDOM % 59))
sed -i "s/@@MINUTES@@/${CRON_MINS}/" /etc/crontabs/root
if [[ $(date "+%-H") == 0 && $(date "+%-m") -lt ${CRON_MINS} ]]; then
NEXT_HOUR=0
elif [[ $(date "+%-H") == 6 && $(date "+%-m") -lt ${CRON_MINS} ]]; then
NEXT_HOUR=6
elif [[ $(date "+%-H") == 12 && $(date "+%-m") -lt ${CRON_MINS} ]]; then
NEXT_HOUR=12
elif [[ $(date "+%-H") == 18 && $(date "+%-m") -lt ${CRON_MINS} ]]; then
NEXT_HOUR=18
elif [[ $(date "+%-H") -ge 0 && $(date "+%-H") -le 5 ]]; then
NEXT_HOUR=6
elif [[ $(date "+%-H") -ge 6 && $(date "+%-H") -le 11 ]]; then
NEXT_HOUR=12
elif [[ $(date "+%-H") -ge 12 && $(date "+%-H") -le 17 ]]; then
NEXT_HOUR=18
elif [[ $(date "+%-H") -ge 18 && $(date "+%-H") -le 23 ]]; then
NEXT_HOUR=0
fi
echo "[mod-init] Mod updates will run every 6 hours at ${CRON_MINS} minutes past the hour. Next update will be at $(date -d${NEXT_HOUR}:${CRON_MINS} '+%H:%m')."
printf %s "${DOCKER_MODS}" > /run/s6/container_environment/DOCKER_MODS_STATIC
/app/update-mods.sh