Skip to content

Instantly share code, notes, and snippets.

@Andsbf
Last active March 12, 2023 10:32
Show Gist options
  • Save Andsbf/56a7ff4572e8b03a8cdf0c955a6c43bc to your computer and use it in GitHub Desktop.
Save Andsbf/56a7ff4572e8b03a8cdf0c955a6c43bc to your computer and use it in GitHub Desktop.
[Unit]
Description=Download IP Geolocation Database from Maxmind.com
[Service]
Type=oneshot
WorkingDirectory=/tmp
ExecStart=/bin/sh -c "\
mkdir -p /home/core/ip_database \
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz ; \
gunzip GeoLite2-City.mmdb.gz ; \
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.md5 ; \
md5result=$(md5sum -c <<< \"`cat GeoLite2-City.md5` GeoLite2-City.mmdb\" | awk '{print $2}') ; \
if [ \"$md5result\" == 'OK' ]; then cp GeoLite2-City.mmdb /home/core/ip_database/GeoLite2-City.mmdb; else exit 1 ; fi"
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment