Sindbad~EG File Manager
#!/bin/bash
rm -fr /tmp/badips.inc /tmp/tor.inc /tmp/GeoIP2-Country.mmdb /tmp/GeoIP2-ISP.mmdb
echo "Checking /var/log/openrestyerror.log size"
test -e /var/log/openrestyerror.log && test $(stat --printf='%s' /var/log/openrestyerror.log) -gt 500000000 && echo '.' > /var/log/openrestyerror.log
echo "Updating /tmp/badips.inc ..."
bash /etc/nginx/openresty/utils/bad-ips.sh > /tmp/badips.inc
echo "Updating /tmp/tor.inc ..."
bash /etc/nginx/openresty/utils/tor-exit-list-map.sh > /tmp/tor.inc
echo "Updating /tmp/GeoIP2-Country.mmdb /tmp/GeoIP2-ISP.mmdb ..."
bash /etc/nginx/openresty/utils/maxmind-geoip2.sh
if ! test -e /tmp/GeoIP2-Country.mmdb ; then
echo "/tmp/GeoIP2-Country.mmdb dont exists"
exit 1
fi
if ! test -e test -e /tmp/GeoIP2-ISP.mmdb ; then
echo "/tmp/GeoIP2-ISP.mmdb dont exists"
exit 1
fi
if /usr/local/openresty/nginx/sbin/nginx -t -c /etc/nginx/openresty/utils/nginx_test.conf ; then
echo "Nginx config OK"
mv -f /tmp/badips.inc /etc/nginx/openresty/custom_security/generated/badips.inc
mv -f /tmp/tor.inc /etc/nginx/openresty/custom_security/generated/tor.inc
mv -f /tmp/GeoIP2-Country.mmdb /etc/nginx/openresty/geoip_db/GeoIP2-Country.mmdb
mv -f /tmp/GeoIP2-ISP.mmdb /etc/nginx/openresty/geoip_db/GeoIP2-ISP.mmdb
echo "Files updated"
### /usr/local/openresty/nginx/sbin/nginx -s reload
else
echo "Nginx config failed, aborting"
rm -fr /tmp/badips.inc /tmp/tor.inc /tmp/GeoIP2-Country.mmdb /tmp/GeoIP2-ISP.mmdb
fi
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists