Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

64 lines
1.3 KiB

#!/bin/bash
### DO NOT EDIT THIS FILE
function usage {
echo
echoMainTitle "Creates a subdomain on plesk server"
echo
echoSubTitle "Usage:"
echo
echo "project-manager plesk:create-subdomain [project-shortname] [env]"
echo
echo " [env] could be live or stage"
echo
echo "--help Prints this message"
echo
}
source "$project_manager_dir/bin/includes/project_header"
env="$(getArgument "$2" "$(usage)" "live stage")"
pleskValidate "$env"
domain="$(getConfig "$env" "domain")"
split=($(echo $domain | tr "." "\n"))
count="${#split[@]}"
((length=$count-2))
sub=''
for i in "${!split[@]}"
do
((j=$i+1))
if [ "$j" -lt "$length" ]
then
sub+="${split[$i]}."
fi
if [ "$j" -eq "$length" ]
then
sub+="${split[$i]}"
fi
done
domain="$(echo "$domain" | sed "s/$(sedEscape "$sub")\.//")"
echo
echoMainTitle "Adding subdomain on plesk server"
echo
echoSubTitle "Please verify data"
echo
echo "-- $env"
echo "Domain: $domain"
echo "Sub: $sub"
echo
echo "Plesk host: $plesk_host"
echo "Plesk user: $plesk_user"
echo "Plesk private key: $plesk_private_key"
echo "Plesk public key: $plesk_public_key"
echo
confirm
pleskAddSSHKey
ssh "$plesk_user@$plesk_host" "plesk bin subdomain --create '$sub' -domain '$domain' -www-root '/$sub.$domain'"
echo
echoSuccess "Subdomain has been created on plesk"
echo