Sunday 31 July 2011

Ubuntu - Script auto update Maxmind library using sh

Hello,

This is script auto update library Maxmind using sh file:
  1. Create new sh file:
    • Create blank text file: E.G. updateGeoIP
    • Run command line: sudo chmod +x updateGeoIP
  2. Copy this script to sh file:
    • #!/bin/sh

      pathGeoIP="/usr/share/GeoIP"

      urlGeoIP="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"
      urlGeoIPv6="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz"

      cd $pathGeoIP && wget $urlGeoIP && gzip -d -f "GeoIP.dat.gz"
      cd $pathGeoIP && wget $urlGeoIPv6 && gzip -d -f "GeoIPv6.dat.gz"
  3. Create crontab:
    • crontab -e
    • Update new cron for this script: E.G. 1 1 10 * * sh /home/tools/updateGeoIp

Done!

No comments:

Post a Comment