Ok I've made following custom subdomain_create_post.sh script.
I know delete the directories it made by default. But what if these directories were not made by adding the subdomain?
For example in my maindoamin.com I have a folder called "help". If I now want to make a separate sub domain help.maindomain.com, the scripts now erases the existing directory in my maindomain.
Any idea how I can check this? Do i have to check all dates of creation or something?
Or an other procedure, idea would be very welcome.
Code:
#!/bin/sh
ORIG_PUB_SUB_PATH="/home/$username/domains/$domain/public_html/$subdomain"
ORIG_PRV_SUB_PATH="/home/$username/domains/$domain/private_html/$subdomain"
SUBDOMAIN_PATH="/home/$username/domains/$subdomain.$domain"
mkdir -m 711 $SUBDOMAIN_PATH
mkdir -m 750 $SUBDOMAIN_PATH/public_html
mkdir -m 755 $SUBDOMAIN_PATH/public_html/cgi-bin
mkdir -m 750 $SUBDOMAIN_PATH/private_html
mkdir -m 755 $SUBDOMAIN_PATH/private_html/cgi-bin
cp $ORIG_PUB_SUB_PATH/index.html $SUBDOMAIN_PATH/public_html/
cp $ORIG_PUB_SUB_PATH/index.html $SUBDOMAIN_PATH/private_html/
chown -R $username:$username $SUBDOMAIN_PATH
rm -rf $ORIG_PUB_SUB_PATH
rm -rf $ORIG_PRV_SUB_PATH