Skip to content

Instantly share code, notes, and snippets.

@Andsbf
Last active Jun 28, 2016
Embed
What would you like to do?
[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