Bash script for automatic transfer of cpanel accounts to directadmin

Hi everybody

I have created a bash script to automatically transfer cpanel user accounts to directadmin, which I will share with you.
I hope this will be helpful to you.

The script performs these steps:

– Create a full account backup on cpanel. (This full backup does not include the public_html directory)
– Transfer the backup to the server directadmin and restore it.
– After the full backup in directadmin, the public_html user directory information is restored in the transfer from cpanel to the public_html user directory in the directadmin directory.
– Removes cpanel full backups from both servers in order to prevent space occupation.
– Change the IP address of the account in the cpanel panel to the IP address of the directadmin server to load the site from the directadmin server.
– Suspends the user in the cpanel server so that the user does not have access to the previous panel.

These steps are performed respectively for each cpanel user account.

Note that you must add the DirectAdmin IP Server from the "Add New IP Address" section of the WHM panel before running the script.
If you do not want to change the IP address after the account transfer, remove the following line from the script:
/ usr / local / cpanel / bin / setsiteip -u $ USER $ DEST

Note that the connection between the servers must be established via the ssh key.

Important note: none of the cpanel accounts should be suspended! If this is the case, the script will not work properly.

You can see the script below:


#You can get the script updates from

#Note that you need to add the DirectAdmin IP server from the "Add a New IP Address" section on the WHM panel before running the script.
#If you do not intend to change the IP after transferring the account, remove the following line from the script:
#/usr/local/cpanel/bin/setsiteip -u $USER $DEST

#Note that the connection between servers must be established via the ssh key.

#Important note that none of cpanel accounts should be suspended! If so, the script will not work correctly.

DEST="" #Your DirectAdmin Server IP
PORT="22" #Your Directadmin Server ssh Port
cd /var/cpanel/users
for USER in *; do
if ( "$USER" != "system" )
       echo "starting transfer process for $USER"
	sleep 2

        #backup cpanel account (public_html excludes) and transfer to directadmin server.
        /scripts/pkgacct $USER --skippublichtml
        rsync -av -e "ssh -p $PORT" /home/cpmove-$USER.tar.gz root@$DEST:/backup/

	#Restore backup in directadmin server.
	ssh -p $PORT root@$DEST "
		chown admin.admin /backup/
		chown admin.admin /backup/cpmove-$USER.tar.gz
		echo 'action=restore&ip%5Fchoice=select&ip=$DEST&local%5Fpath=%2Fbackup&owner=admin&select%30=cpmove-$USER.tar.gz&type=admin&value=multiple&when=now&where=local' >> /usr/local/directadmin/data/task.queue
		echo "backup is restoring in DirectAdmin!"
		sleep 2
		while $(grep -Fq "action=restore" /usr/local/directadmin/data/task.queue 2>/dev/null); do printf "%s""$i" .; sleep 2; done;
		while $(test ! -d /home/$USER/public_html); do printf "%s""$i" .; sleep 2; done;
		printf 'n'
		echo "backup restoration completed in DirectAdmin!"
		sleep 2
	#transfer public_html files and dirs to destinaton server	
	rsync -av -e "ssh -p $PORT" /home/$USER/public_html/ root@$DEST:/home/$USER/public_html/
	ssh -p $PORT root@$DEST "
		chown -R $USER.$USER /home/$USER/public_html/
		find /home/$USER/public_html/ -type d -exec chmod 755 {} ;

	#remove backup files in order to free space
	ssh -p $PORT root@$DEST "rm /backup/cpmove-$USER.tar.gz"
	rm /home/cpmove-$USER.tar.gz

	#change user ip in order to transfer site loding to destination server.
	/usr/local/cpanel/bin/setsiteip -u $USER $DEST	

	/scripts/suspendacct $USER "User transferred to Direct Admin."

	echo "transfer process for $USER has been completed!"
	sleep 2
	printf 'n'

VPS with dedicated IP – How to offer email accounts?

Hello, I propose a fully managed VPS hosting where each server receives a dedicated IP address and, since we manage the entire server, we do not offer cPanel. … | Read the rest of

Where to buy Twitter accounts?

Twitter is top
social networks With hundreds of millions of users. Buy Twitter accounts, it's
the best solutions for those looking to promote business in this area.
networks. Twitter is the best to promote your service or your
product. These accounts will make you look more popular on Twitter, as well as
Increase your sales, followers and customers for your business.

We offer high quality
instagram accounts at affordable prices on the market. All accounts all
Confirmed emails, Complete profile, Profile image. You can buy twitter accounts
very low price. we gave you all the packages below. If you want to order now please
click on the buy now button. he will deliver you a basket, where you have to
enter your details. In all cases where you had problems, please contact us.

Why buy Instagram accounts for your business?

Purchase of Instagram
Accounts are the best way to increase the benefits of your services or products.
Instagram is a free photo sharing program and a social network. The service
allows users to take a photo, apply a digital filter, and share it
with other Instagram users, they are connected to the social network, as well
like on a variety of social networking services. You can "like" or comment on the
pictures, and see what's new. It's easy and it does not take a lot of time or effort.
That's one of the reasons he became so popular so quickly.

If you are looking for
the best place for buy Instagram accountswe offer high quality instagram
accounts at the most affordable prices.

Why buy Youtube accounts?

Buy Youtube accounts for traffic and promote your website or
some products. If you are looking for the best place to buy Youtube accounts, we
offer high quality Youtube accounts. All accounts all confirmed emails, Completely
Profiled, Profile of the image. The main feature is that these accounts are created with
Gmail accounts. And we will provide you with basic email ID login information with
youtube account credentials. You can buy YouTube accounts at the best price
. We provide bulk YouTube accounts created with a unique IP address.

Why buy Pinterset accounts?

Pinterest is the third most popular social media network in the world. Just like most current social networking sites. Buy Pinterest Accounts and increase your Pinterest followers and increase your sales or traffic. Pinterest is a place where people can meet other people sharing the same interest as theirs. Pinterest pins allow you to customize your product, make offers, comment on your product and increase awareness of your product!

If you want to increase the number of followers on Pinterest? We offer high quality pinterest accounts at the most affordable prices. we gave you all the packages below. If you want to order now, click on the buy now button. he will deliver you a shopping cart in which you must enter your details. In all cases where you had problems, please contact us.

subscription – A platform designed to support both: subscribers and user accounts?

We have created a platform where users can subscribe to newsletters from their favorite organizations (similar to Mailchimp). But we also want to allow subscribers to post content on their organization's page (similar to Yelp or Meetup).

We are concerned that if we forced everyone to create accounts, it would deter those who are new or just want to receive the weekly newsletter.

We are in the early stages and our goal is to expand our user base as much as possible.

Are there lessons from the past or existing examples that we can learn from?

Negotiate like a pro, no emotions + build small accounts – 10% profit on #ETH thanks to a big scalping automatically negotiated via Bot. – Advertising, offers

Visit our group and get a free encryption signal, witness the guaranteed profit group, crypto and bitcoin bot –

Coinbase reviewed the top 50 universities in the world and found that 56% of them have blockchain or crypto classes. 735 students aged 16 and over experienced a 6% increase in student interest in crypto or blockchain courses. This interest in studying cryptography in colleges and universities speaks volumes about the future of money.

A #RCN call was recorded in the guaranteed profit group. 34 out of 34 signals reported so far have resulted in a 100% success rate, which is INCREDIBLE !!

You can see that the chart #RCN – Guaranteed Profit Group – Members were informed early on the upward trend of the coin – It was raised to generate a good profit.

Crypto allows you to make steady profits only when you know the right part that will be profitable. Be part of the largest Premium community – Our signals move the market. You can only improve your crypto wallet if you are trading a good room or HOLD a good room (Trade with Pro).

. (tagsToTranslate) bitcoin bot (t) bitmex (t) crypto bot