Skip to content

Instantly share code, notes, and snippets.

@kselax
Created May 10, 2018 13:39
Show Gist options
  • Select an option

  • Save kselax/1da1051600e0cefd3a949e8c61dcceaf to your computer and use it in GitHub Desktop.

Select an option

Save kselax/1da1051600e0cefd3a949e8c61dcceaf to your computer and use it in GitHub Desktop.
Shell script copy wordpress new latest wordpress site to your /var/www/
#!/bin/bash
#script will accept site domain_name and
#will copy lates version wordpress to
#/var/www/domain_name directory
#1 accept domain_name
#global varialbes
domain_name=$1
path="/var/www/$domain_name"
URL="https://wordpress.org/latest.tar.gz"
echo "domain_name = $domain_name"
echo "path = $path"
#download wordpress
echo "current_path = $current_path"
#check whether directory exists
if [ ! -d "$path" ] ; then
echo "direcotry \"$path\" doesn't exist"
exit
fi
echo "directory \"$path\" exist"
current_path=`pwd`
cd $path
#curl -O https://wordpress.org/latest.tar.gz
curl -O $URL
#unzip wordpress
tar -zxvf latest.tar.gz
#go to wordpress
cd wordpress
#copy files to parent directory
rsync -av . ..
#go to parent directory
cd ..
#remove wordpress and latest.tar.gz
rm latest.tar.gz
rm -r wordpress
echo "wordpress has been successfuly installed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment