Files
pics/tools/update_geoip.sh
Thomas Lynch 1f2023e48a small tools tweaks
/etc/nginx/ "includes" -> "snippets"
remove nginx reload, since there are multiple tools that require that. better to have a separate cron task that does it after just once
and add execute bit... lol
2022-04-06 16:06:06 +10:00

17 lines
495 B
Bash
Executable File

#!/bin/bash
#
# Script to update geoip database for nginx/jschan. Can be added as a cronjob
#
#go to geoip folder
cd /usr/share/GeoIP
#move the existing db to a .bak just in case
mv GeoIP.dat GeoIP.dat.bak
#try and download the DBIP database
wget --retry-connrefused https://dl.miyuru.lk/geoip/dbip/country/dbip.dat.gz
#extract and move it
gunzip dbip.dat.gz
mv dbip.dat GeoIP.dat
#make sure www-data (debian nginx user:group) has permissions
chown www-data:www-data /usr/share/GeoIP/GeoIP.dat