forked from K0p1-Git/cloudflare-ddns-updater
-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
64 lines (55 loc) · 1.52 KB
/
entrypoint.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#check if vars aure set
if [[ -z "${AUTH_EMAIL}" ]]; then
echo "AUTH_EMAIL is not set"
exit 1
fi
if [[ -z "${AUTH_METHOD}" ]]; then
echo "AUTH_METHOD is not set"
exit 1
fi
if [[ -z "${AUTH_KEY}" ]]; then
echo "AUTH_KEY is not set"
exit 1
fi
if [[ -z "${ZONE_IDENTIFIER}" ]]; then
echo "ZONE_IDENTIFIER is not set"
exit 1
fi
if [[ -z "${RECORD_NAME}" ]]; then
echo "RECORD_NAME is not set"
exit 1
fi
if [[ -z "${TTL}" ]]; then
echo "TTL is not set"
exit 1
fi
if [[ -z "${PROXY}" ]]; then
echo "PROXY is not set"
exit 1
fi
echo "=================================="
echo "cloudflare-ddns-docker by officialEmmel based on script by K0p1-Git"
echo "=================================="
echo "Auth Email: ${AUTH_EMAIL}"
echo "Auth Method: ${AUTH_METHOD}"
echo "Auth Key: ***"
echo "Zone Identifier: ${ZONE_IDENTIFIER}"
echo "Record Name: ${RECORD_NAME}"
echo "TTL: ${TTL}"
echo "Proxy: ${PROXY}"
echo "Crond Job: ${CRON_JOB:-0 * * * *}"
echo "=================================="
# install cron job
echo ">> installing cron job"
cronjob="${CRON_JOB:-0 * * * *}"
cronjob_log="${CRON_JOB_LOG:-/var/log/cron.log}"
echo "$cronjob /bin/bash /usr/local/bin/cloudflare-ddns.sh" > /usr/local/bin/cloudflare-ddns-cron
chmod 0644 /usr/local/bin/cloudflare-ddns-cron
crontab /usr/local/bin/cloudflare-ddns-cron
echo ">> loading env vars"
printenv | grep -v "no_proxy" >> /etc/environment
echo ">> setup ready. starting cron... ($(date "+%Y-%m-%d %H:%M:%S"))"
echo "=================================="
# start cron
crond -f -l 2