forked from wahyd4/aria2-ariang-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew-version-checker.sh
executable file
·31 lines (28 loc) · 1.04 KB
/
new-version-checker.sh
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
31
#! /bin/bash -u
sleep 5
if [ "$ENABLE_APP_CHECKER" = "false" ]; then
echo "[INFO] Skip checking new version"
# Do nothing and just sleep 10 years
sleep 315360000
exit 0
fi
set -e
APP_VERSION=$(cat APP_VERSION)
set +e
while true; do
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Checking for new version against ${APP_VERSION} ..."
newer_version=$(curl --max-time 6 -s "https://badges.toozhao.com/val/aria2-ui-docker?version=${APP_VERSION}&arch=$(arch)")
if [[ -z ${newer_version} ]]; then
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Failed to check new version."
sleep 86400
continue
fi
if [[ ${newer_version} > ${APP_VERSION} ]]; then
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Found newer Docker image version wahyd4/aria2-ui:${newer_version}, please consider to upgrade by using docker pull command to have better user experience."
# check new version daily
sleep 86400
continue
fi
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Congrats, you are using the latest version docker image"
sleep 86400
done