monuntainyman
Programmer
Hi all,
The script below is intended to help in exporting a wordpress website from a staging server to a domain.
It accepts 2 inputs an old domain and a new domain. These are put in manually at the start of the export process.
I would like to read in a list of old domains and new domains in the following format
and have the process run automatically.
This is the process as it stands I prompt myself for both values.
I tried this before and it worked but only if the file only contained 1 pair of values. Otherwise the sed happened at what looked like random.
The script below is intended to help in exporting a wordpress website from a staging server to a domain.
It accepts 2 inputs an old domain and a new domain. These are put in manually at the start of the export process.
I would like to read in a list of old domains and new domains in the following format
Code:
fish.staging.ie:ilovefish.ie
cows.staging.ie:thecowssite.com
love.staging.ie:whatislove.net
and have the process run automatically.
This is the process as it stands I prompt myself for both values.
Code:
#!/bin/bash
#Script to alter text in database in order to prepare a
#wordpress website for export
read -p "Enter the old domain name : " OLD_DOMAIN
read -p "Enter the new domain name : " NEW_DOMAIN
PATH_TO="/supermonkey/newsites/"
/usr/bin/mysqldump -f -u dbuser-sme"$OLD_DOMAIN" -p[PASSWORD] sme"$OLD_DOMAIN" >""$PATH_TO"/"$NEW_DOMAIN"/sme"$NEW_DOMAIN".SQL"
SQL_FILE=""$PATH_TO"/"$NEW_DOMAIN"/sme"$NEW_DOMAIN".SQL"
if [ -f $SQL_FILE ]
then
read -p "Step 01 Complete: SQL File created"
else
read -p "Step 02 Failed: SQL File was not created"
fi
I tried this before and it worked but only if the file only contained 1 pair of values. Otherwise the sed happened at what looked like random.
Code:
#!/bin/bash
#Script to read a list of files and convert databases
while IFS=: read OLD_DOMAIN NEW_DOMAIN
do
done < /home/supermonkey/allsites/supmdomainlist.txt