Created
May 25, 2012 20:32
-
-
Save daogurtsov/2790417 to your computer and use it in GitHub Desktop.
wordpress cloning,wp-config installation, setting permissions for new copies
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/sh | |
| #log file for finished copies | |
| log=logs/logwp.txt | |
| wordpressFileName=wordpress-3.4 | |
| wordpressPath="$wordpressFileName" | |
| #path to sites config settings file | |
| sitesConfigSettingsPath=domains.txt | |
| #destination directory - the only path that you | |
| # have to change from hosting to hosting | |
| path=/var/chroot/home/content/46/9148346/html/d | |
| echo "Enter group name:" | |
| #optional | |
| read group < /dev/tty | |
| echo "Enter user name:" | |
| #optional | |
| read user < /dev/tty | |
| #END VARS DECLARATION | |
| if [ -d "$wordpressPath" -a -f "$sitesConfigSettingsPath" ];then | |
| if [ ! -f "$log" ]; then | |
| touch "$log" | |
| else | |
| rm "$log" | |
| touch "$log" | |
| fi | |
| #If destination dir doesn't exist | |
| #mkdir "$dir" | |
| if [ ! -d "$path" ]; then | |
| mkdir "$path" | |
| fi | |
| while read domain db_name db_user db_pass db_host | |
| do | |
| mkdir "$path"/"$domain" | |
| cp -r "$wordpressPath"/. "$path"/"$domain" | |
| if [ -z "$group" ]; then | |
| chgrp -R "$group" "$path"/"$domain" | |
| fi | |
| if [ -z "$user" ]; then | |
| chown -R "$user" "$path"/"$domain" | |
| fi | |
| lastpath=$(pwd) | |
| cd "$path"/"$domain" | |
| sed -e "s/database_name_here/$db_name/;s/username_here/$db_user/;s/password_here/$db_pass/;s/localhost/$db_host/" wp-config.php> /tmp/tempfile.tmp | |
| mv /tmp/tempfile.tmp wp-config.php | |
| cd "$lastpath" | |
| date=`date` | |
| echo "$domain $date">>"$log" | |
| done <"$sitesConfigSettingsPath" | |
| echo "=====================================" | |
| cat "$log" | |
| wc -l "$log" | |
| echo "sites finished" | |
| echo "==============" | |
| echo "FINISHED" | |
| else | |
| echo "Check path to wordpress zip - $wordpressPath and path to domains list - $sitesConfigSettingsPath" | |
| fi | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before running:
/__ The name of the database for WordPress /
define('DB_NAME', 'database_name_here');
/* MySQL database username /
define('DB_USER', 'username_here');
/* MySQL database password /
define('DB_PASSWORD', 'password_here');
/* MySQL hostname */
define('DB_HOST', 'localhost');
2.file with domains list has to be unix formatted and has structure:
DomainFolderName db_name username password host