Z
zymsys
Guest
I saw a lot of people requesting the domain aliasing feature, and for me it is a show stopper. I'm trying to migrate to plesk and without it I can't do that migration.
I looked for existing hacks to do this, but couldn't find anything. I wrote this script, and it seems to work pretty well. I hope it will either help some of you, or someone will point out that something bad will happen if I use it before I begin to depend on it!
I called my copy newalias, and it is run like this:
I looked for existing hacks to do this, but couldn't find anything. I wrote this script, and it seems to work pretty well. I hope it will either help some of you, or someone will point out that something bad will happen if I use it before I begin to depend on it!
Code:
#!/bin/bash
# Do not use a www prefix with these domain names!
# $1 Existing domain as known by plesk
# $2 New domain to create
echo "ServerAlias $1:80 [url]www.[/url]$2" >> /home/httpd/vhosts/$1/conf/vhost.conf
echo "ServerAlias $1:80 $2" >> /home/httpd/vhosts/$1/conf/vhost.conf
echo $2 >> /var/qmail/control/rcpthosts
DOMNUM=`grep "$1:" /var/qmail/control/virtualdomains | cut -f 2 -d':'`
echo "$2:$DOMNUM" >> /var/qmail/control/virtualdomains
/usr/local/psa/admin/sbin/websrvmng -a -v
QSPID=`ps aux |grep qmail-send |grep -v grep|sed 's/[^0-9]*\([0-9]*\).*/\1/'`
kill -HUP $QSPID
I called my copy newalias, and it is run like this:
Code:
./newalias existingdomain.com newdomain.com