Created
November 24, 2021 12:28
-
-
Save chrisjangl/7362db6ae26ff211b7d7dbe268506ab3 to your computer and use it in GitHub Desktop.
Working from a list of WordPress sites on a shared hosting environment (sites.txt), this script will print the DB name and login URL for each site.
This file contains 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
i=1 | |
touch urls.txt | |
COUNT=$(wc -l sites.txt) | |
for SITE in $(cat sites.txt) | |
do | |
cd $SITE | |
echo "Working on $SITE ($i of $COUNT)..." | |
echo "## $SITE" >> ../urls.txt | |
url=$(wp option get siteurl) | |
postURL="/wp-login.php" | |
db=$(wp config get DB_NAME) | |
echo "DB: $db" >> ../urls.txt | |
echo $url$postURL >> ../urls.txt | |
echo "----------------" >> ../urls.txt | |
echo " " >> ../urls.txt | |
echo " " >> ../urls.txt | |
echo " " >> ../urls.txt | |
((i=i+1)) | |
clear | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment