Created
March 29, 2023 06:57
-
-
Save homu9/6d584e25193c2f3926c30cf1d9d2b700 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Change directory to /home | |
cd /home | |
# Iterate through all users directories | |
for user in * ; do | |
# For every webapp under the user directory | |
# Count wp-config files to make sure its Wordpess | |
# If its Wordpress, then run the WP CLI Script, which calls wp-cron.php | |
#先得进入目录,不然 d 得到的不是webapps 名字, 而是路径 | |
cd /home/$user/webapps | |
for d in * ; do | |
count_file=`ls -1 /home/$user/webapps/$d/wp-config.php 2>/dev/null | wc -l` | |
if [ "$count_file" != "0" ] | |
then | |
echo $d 'is WordPress' | |
touch //etc/nginx-rc/extra.d/$d.location.root.block-astra-update.conf | |
tee //etc/nginx-rc/extra.d/$d.location.root.block-astra-update.conf << 'EOF' | |
if ($args ~* "action=wp_addon_database_migration") { | |
return 403; | |
} | |
EOF | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment