Skip to content

Instantly share code, notes, and snippets.

@centminmod
Last active May 8, 2019 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save centminmod/bbaa3a5dfc78fbb199db193beb7719ee to your computer and use it in GitHub Desktop.
Save centminmod/bbaa3a5dfc78fbb199db193beb7719ee to your computer and use it in GitHub Desktop.
wpinfo.sh for centmin.sh menu option 22
#!/bin/bash
####################################################
# curl -4sL https://gist.githubusercontent.com/centminmod/bbaa3a5dfc78fbb199db193beb7719ee/raw/wpinfo-generator.sh | bash -s yourdomain.com
####################################################
vhostname=yourdomain.com
if [ $1 ]; then
vhostname=$1
fi
# create /usr/local/nginx/conf/wpincludes/${vhostname}/wpinfo.sh
if [ -d "/usr/local/nginx/conf/wpincludes/${vhostname}" ]; then
cat > "/usr/local/nginx/conf/wpincludes/${vhostname}/wpinfo.sh" <<EOF
#!/bin/bash
WPSITE_INSTALLPATH='/home/nginx/domains/${vhostname}/public'
cd \$WPSITE_INSTALLPATH;
wp cli version --allow-root;
echo "WP-Home \$(wp option get home --allow-root)";
echo "WP-SiteURL \$(wp option get siteurl --allow-root)";
wp core version --extra --allow-root | column -t;
wp user list --role=administrator --allow-root;
wp config list --allow-root;
wp plugin list --allow-root;
wp theme list --allow-root;
EOF
chmod +x /usr/local/nginx/conf/wpincludes/${vhostname}/wpinfo.sh
else
echo "existing wordpress installation not detected"
echo "can not find directory at:"
echo "/usr/local/nginx/conf/wpincludes/${vhostname}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment