Skip to content

Instantly share code, notes, and snippets.

@c80609a
Forked from Andsbf/ip_db.service
Created March 12, 2023 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c80609a/f7937561e4d00d096b88cb3624138c1a to your computer and use it in GitHub Desktop.
Save c80609a/f7937561e4d00d096b88cb3624138c1a 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