Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.83 KB | None | 0 0
  1. #!/bin/bash
  2. sites=`ls -l /home/shnize78/public_html|awk '{print $9}'`
  3. num=1
  4. for site in $sites; do
  5.  if [ -e "/home/shnize78/public_html/$site/wp-config.php" ]; then
  6.   name=`grep -i "DB_NAME" /home/shnize78/public_html/$site/wp-config.php | awk -F',' '{print $2}' | awk -F')' '{print $1}' | awk -F"'" '{print $2}'`
  7.   pass=`grep -i "DB_PASSWORD" /home/shnize78/public_html/$site/wp-config.php | awk -F',' '{print $2}' | awk -F')' '{print $1}' | awk -F"'" '{print $2}'`
  8.   user=`grep -i "DB_USER" /home/shnize78/public_html/$site/wp-config.php | awk -F',' '{print $2}' | awk -F')' '{print $1}' | awk -F"'" '{print $2}'`
  9.  
  10.   MYSQL=`mysqladmin -u$user -p$pass status 1> /dev/null 2> /dev/null`
  11.   if [ "$?" -ne "0" ]; then
  12.    echo "[-] $site MySQL Login Failed"
  13.  
  14.    # Step 1, create the database and allow the blog user access
  15.    # Blog user's pass: $L,V?MRzylB8
  16.    #mysql -e "create database shnize78_blog${num} character set utf8;"
  17.    #mysql -e "GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , REFERENCES , INDEX , ALTER , CREATE TEMPORARY TABLES , LOCK TABLES , EXECUTE on shnize78_blog${num} . * to 'shnize78_blog'@'localhost'"
  18.  
  19.    # Step 2, Clean out the existing folders
  20.    #mv /home/shnize78/public_html/$site /home/shnize78/public_html/${site}.backup
  21.    #mkdir /home/shnize78/public_html/$site
  22.  
  23.    # Step 3, Get the right directory
  24.    site1=`echo $site | awk -F'.' '{print $1}'`
  25.    site2=`echo $site | awk -F'.' '{print $2}'`
  26.    site=${site1}.${site2}
  27.    #echo $site
  28.  
  29.    # Step 4, Untar the new install
  30.    #tar -xzf /home/shnize78/latest.tar.gz -C /home/shnize78/public_html/$site/
  31.  
  32.    # Step 5, Move the new wordpress into the proper directory
  33.    #mv /home/shnize78/public_html/$site/wordpress/* /home/shnize78/public_html/$site/
  34.  
  35.    # Step 6, Install in browser..
  36.  
  37.    # Increment the ID
  38.    num=$(($num+1))
  39.   fi
  40.  fi
  41. done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement