-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-entrypoint.sh
executable file
·42 lines (33 loc) · 1.06 KB
/
docker-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
#!/bin/bash
set -e
USER_ID=${USER_ID:-'999999'}
LICENSE_KEY=${LICENSE_KEY:-'000000000000'}
PRODUCT_IDS=${PRODUCT_IDS:-'GeoLite2-City GeoLite2-Country GeoLite-Legacy-IPv6-City GeoLite-Legacy-IPv6-Country 506 517 533'}
cat > /etc/GeoIP.conf <<EOL
# The following UserId and LicenseKey are required placeholders:
UserId $USER_ID
LicenseKey $LICENSE_KEY
# Include one or more of the following ProductIds:
# * GeoLite2-City - GeoLite 2 City
# * GeoLite2-Country - GeoLite2 Country
# * GeoLite-Legacy-IPv6-City - GeoLite Legacy IPv6 City
# * GeoLite-Legacy-IPv6-Country - GeoLite Legacy IPv6 Country
# * 506 - GeoLite Legacy Country
# * 517 - GeoLite Legacy ASN
# * 533 - GeoLite Legacy City
ProductIds $PRODUCT_IDS
EOL
geoipupdate -v
if [ "$1" = 'cron' ]; then
CRONTAB_MAILTO=${CRONTAB_MAILTO:-$(whoami)}
CRONTAB_FREQUENCY=${CRONTAB_FREQUENCY:-'0 0 * * 1'}
cat > ~/crontab <<EOL
# top of crontab
MAILTO=$CRONTAB_MAILTO
$CRONTAB_FREQUENCY /usr/local/bin/geoipupdate > /home/$(whoami)/geoipupdate.log 2>&1
# end of crontab
EOL
crontab ~/crontab
cron -f
fi
exec "$@"