Shell Script To Update MaxMind GeoIP Database

March 4, 2022 . 2 MIN READ

chown -R runcloud:runcloud /usr/share/GeoIP/

cp /usr/share/GeoIP/GeoIP2-Country.mmdb /home/runcloud/webapps/app-staging21-2gamecms-com/storage/app/maxmind/GeoIP2-Country.mmdb

cd /usr/share/GeoIP/

# Regular cron job for the geoipupdate package, used to update GeoIP databases

#

# According to MaxMind: “The GeoIP2 and GeoIP Legacy Country and City databases

# are updated every Tuesday. The GeoIP2 ISP, GeoIP Legacy ISP and Organization

# databases are updated every one to two weeks. All other databases are updated

# on the first Tuesday of each month.”

# m h dom mon dow user  command

47 6    * * 3   root    test -x /usr/bin/geoipupdate && /usr/bin/geoipupdate

chown -R root:root /home/runcloud/webapps

/app-staging21/storage/app/maxmind/GeoIP2-Country.mmdb

/RunCloud/Packages/php74rc/bin/php /home/runcloud/webapps/app-staging21–com/artisan schedule:run >> /dev/null 2>&1

cp /usr/share/GeoIP/GeoIP2-Country.mmdb /home/runcloud/webapps/app-com/storage/app/maxmind/GeoIP2-Country.mmdb

I am trying to execute sudo which needs password but how can i giv password from cron file – sayem siam Aug 9 ’12 at 17:59

=>you don’t need to put sudo, just edit the root crontab. –

40 22 * * 0,3 /usr/bin/geoipupdate

GeoIP2dbcopy runcloud cp /usr/share/GeoIP/GeoIP2-Country.mmdb /home/runcloud/webapps/app-2gamecms-com/storage/app/maxmind/GeoIP2-Country.mmdb At 11:30 PM, only on Tuesday30 23 * * 2
geoupdate-cron root /usr/bin/geoipupdate At 11:00 PM, only on Tuesday0 23 * * 2

Reference: https://github.com/maxmind/geoipupdate

https://www.programmersought.com/article/75706466231/

https://zoomadmin.com/HowToInstall/UbuntuPackage/geoipupdate

https://bash.cyberciti.biz/web-server/unix-linux-cronjob-script-to-update-maxmind-geoipdatabase/

Leave a Reply

Your email address will not be published. Required fields are marked *