mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-04 11:40:22 +00:00
update-ngxblocker: reload nginx from curl return code
This commit is contained in:
parent
a082234c3d
commit
130f1655cb
2 changed files with 8 additions and 8 deletions
|
@ -347,4 +347,3 @@ main() {
|
||||||
## START ##
|
## START ##
|
||||||
main $@
|
main $@
|
||||||
exit $?
|
exit $?
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ get_options() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local REPO=https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master
|
local REPO=https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master
|
||||||
local file=globalblacklist.conf remote_dir=conf.d url= output= update= status= tmp=
|
local file=globalblacklist.conf remote_dir=conf.d url= output= update= status= tmp= retval=
|
||||||
# default to service (centos does not have 'which' by default)
|
# default to service (centos does not have 'which' by default)
|
||||||
local service=${service_cmd:-"service"}
|
local service=${service_cmd:-"service"}
|
||||||
|
|
||||||
|
@ -281,8 +281,9 @@ main() {
|
||||||
mkdir -p $CONF_DIR
|
mkdir -p $CONF_DIR
|
||||||
printf "${BOLDWHITE}Downloading: $file "
|
printf "${BOLDWHITE}Downloading: $file "
|
||||||
curl --fail --connect-timeout 60 --retry 10 --retry-delay 5 -so $tmp $url
|
curl --fail --connect-timeout 60 --retry 10 --retry-delay 5 -so $tmp $url
|
||||||
|
retval=$?
|
||||||
|
|
||||||
case "$?" in
|
case "$retval" in
|
||||||
0) printf "...${BOLDGREEN}OK${RESET}\n\n"
|
0) printf "...${BOLDGREEN}OK${RESET}\n\n"
|
||||||
mv $tmp $output
|
mv $tmp $output
|
||||||
;;
|
;;
|
||||||
|
@ -293,11 +294,11 @@ main() {
|
||||||
# download new bots.d / conf.d files
|
# download new bots.d / conf.d files
|
||||||
$INSTALL_INC
|
$INSTALL_INC
|
||||||
|
|
||||||
# re-read nginx configuration
|
# set custom bots.d path
|
||||||
if ! grep "Not Found" $EMAIL_REPORT; then
|
update_paths $output
|
||||||
|
|
||||||
# set custom bots.d path
|
# re-read nginx configuration
|
||||||
update_paths $output
|
if [ $retval = 0 ]; then
|
||||||
|
|
||||||
$service nginx reload
|
$service nginx reload
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
|
@ -310,7 +311,7 @@ main() {
|
||||||
printf "\n${BOLDRED}Download failed${RESET}: not reloading NGINX config\n"
|
printf "\n${BOLDRED}Download failed${RESET}: not reloading NGINX config\n"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# set custom bots.d path
|
# set custom bots.d path
|
||||||
update_paths $output
|
update_paths $output
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue