Update: 18/08/2020 Plesk Obsidian is now able to move domains between subscriptions thus negating the need for any external scripts. Please use this in built function instead. Keeping this article for posterity.
This article could have been called “Merging domains from one subscription to another” or “Moving domains between subscriptions”. But its goal remains the same.ย If you’re arrived at this page then you probably already know what you’re looking for.
With the business model change from Plesk 9 to Plesk 10, the upgrader splits each customer’s domains into it’s own subscription. Highly annoying if you want to keep track of a clients overall usage. What most Plesk users want is to merge all of a client’s subscriptions into a single subscription containing multiple domains, now possible with Plesk 10. Each client’s subscription consists of a “master domain”. Other domains can then be added to the subscription.
When asked, Parallels forum representatives have been dodging the issue since Plesk 10’s release, so there has to this day been no official way of merging subscriptions.ย The manual method seemed the only way.
What i’ve done is created a script to automate this for you. It’s been floating in my head for months but I finally got the motivation to sit down and put it together. Its not a complicated script and i’m not sure why Parallels haven’t done something similar.
This is what it does (currently) at a high level:
- Changes the database ownership of all the DB’s of the old domain to the new subscription.
- Backs up the files in the www root of the domain to be migrated.
- Backs up all mailboxes associated with the domain to be migrated.
- Gets a list of all the email accounts and associated passwords and dumps it to a file for use in a later step.
- Removes the old subscription.
- Re-creates the domain under the desired subscription.
- Reads in the email account list and recreates the mail accounts.
- Restores the files from the old domains www root.
- Restores the mailboxes.
I’ve tried to write this script so that it should work on most if not all Plesk supported Linux distributions. Sorry Windows folks! Nothing personal.ย It does make changes to the psa database directly so I would highly suggest backing up your psa database first. Although i’ve been using this script myself, i’d test it on your systems first on a dummy domain.
Once the script finishes executing, check the ownerships of the files in the new wwwroot as you’ll probably need to fix these before the site will work.
Here’s what it currently doesn’t handle:
- DNS zones with modified entries. Use this script for domains with pretty much unmodified zones from your template, or take note of the changes you made manually and recreate them after the domain has been recreated. I have not yet found an easy way to dump the zone details of the domains and recreate them in an automated fashion.
- Mailing lists. I personally don’t use the mailing lists so I haven’t included that yet.
This is only a version 1 so i’d love to hear your feedback and comments, even if you don’t find it useful, and especially if you DO. Also if you do end up making improvements, please let me know so that I can merge them into the script for the benefit of others.
Changelog
- v1.0 – Initial release.
- v1.1 – Fixed bug with emaillist output file.
Thanks for this script. Been looking for a solution like this since I have an inactive main domain and would like to join them with active subscriptions. The main issue is that all mail is still handled here. Big step to take ๐ Not sure if this still works for the latest Plesk?
Thanks for sharing your experience and knowledge.
It really helped me in merging few subscriptions accounts into one main subscription account.
I have run this script on Plesk 12.0.18 Update #31, last updated at Jan 16, 2015 04:03 AM
and it successfully completed the job.
You have done a great job, and thanks again for sharing this. It saved several hours of mine on weekend and reduced the cost to be billed to client.
Kind Regards,
Muyassir S.
You’re most welcome Muyassir. Glad you found it useful ๐
How do i use it!?
You need to modify the script and edit the parameters at the top of the file:
domain=domain.com.au
masterdomain=masterdomain.com.au
wwwroot=newroot
Yes I could probably have made it more elegant with parameters and all but this was a quick hacked together script and was meant for my use only ๐ Just thought i’d share it.