Discover Centmin Mod today
Register Now

Upgrade maxmind auto update

Discussion in 'Add Ons' started by Oxide, Oct 15, 2015.

  1. Oxide

    Oxide Active Member

    534
    29
    28
    Mar 19, 2015
    Ratings:
    +59
    Local Time:
    5:41 PM
    @eva2000 you wrote this script not so long ago

    Code:
    #!/bin/bash
    \cp -f /usr/share/GeoIP/GeoIP.dat /usr/share/GeoIP/GeoIP.dat-backup
    wget -cnv http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/share/GeoIP/GeoIP.dat.gz
    gzip -df /usr/share/GeoIP/GeoIP.dat.gz
    
    how can i confirm it actually overwrites, also since it's caching.. would i need to restart php or anything at all to make the changes live?

    i want to add this as a cron job, once a month or so when maxmind updates.. :)

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    5:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    check timestamp of the dat file
    Code:
    ls -lah /usr/share/GeoIP/GeoIP.dat
    just do nginx and php-fpm restart to be sure
    Code:
    nprestart
     
  3. Oxide

    Oxide Active Member

    534
    29
    28
    Mar 19, 2015
    Ratings:
    +59
    Local Time:
    5:41 PM

    [root@ns3009754 ~]# ls -lah /usr/share/GeoIP/GeoIP.dat
    -rw-r--r-- 1 root root 784K Oct 9 03:29 /usr/share/GeoIP/GeoIP.dat
    [root@ns3009754 ~]# sh update.sh
    2015-10-18 17:45:04 URL:http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz [461103/461103] -> "/usr/share/GeoIP/GeoIP.dat.gz" [1]
    [root@ns3009754 ~]# ls -lah /usr/share/GeoIP/GeoIP.dat
    -rw-r--r-- 1 root root 784K Oct 9 03:29 /usr/share/GeoIP/GeoIP.dat

    In other words, did not work.. lol
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    5:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    try
    Code:
    #!/bin/bash
    \cp -f /usr/share/GeoIP/GeoIP.dat /usr/share/GeoIP/GeoIP.dat-backup
    rm -rf /usr/share/GeoIP/GeoIP.dat
    wget -cnv http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/share/GeoIP/GeoIP.dat.gz
    gzip -df /usr/share/GeoIP/GeoIP.dat.gz
    wget -cnv http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /usr/share/GeoIP/GeoLiteCity.dat.gz
    rm -rf /usr/share/GeoIP/GeoIPCity.dat
    gzip -d -f /usr/share/GeoIP/GeoLiteCity.dat.gz
    \cp -af /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
    nprestart
    
     
    Last edited: Jan 5, 2016
  5. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    5:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+

    Add tools/geoipdb-update.sh



    Updated Centmin Mod 123.09beta01 build to add to a new tools/geoipdb-update.sh script to allow updating GeoIP country and city databases as well add tools/geoipdb-update.sh · centminmod/centminmod@4f4c5c3 · GitHub

    so you could setup a cronjob every month on the 1st to run it

    Code:
    1 2 1 * * /usr/local/src/centminmod/tools/geoipdb-update.sh >/dev/null 2>&1
    To update your Centmin Mod builds follow instructions at centminmod.com/upgrade.html and respective version thread below: