Author Topic: cPanel Account Restore - subdomains directories  (Read 4535 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
cPanel Account Restore - subdomains directories
« on: August 29, 2019, 11:05:08 PM »
I have tried to restore cPanel account to cwp, and I have noticed that subdomains directories
ex:
Code: [Select]
/home/testacc/test.example.com/ has only default index page of cwp and not files from restoration file.

Offline
*
Re: cPanel Account Restore - subdomains directories
« Reply #1 on: August 30, 2019, 01:32:49 AM »
I have created simple script to fix that for me.
it will keep all user home directory files/directories and exclude not necessary directories of cpanel conf...
how to use :
  • restoration file should be exist in '/home' example: '/home/cpmove-testuser.tar.gz'.
  • do cpanel restoration from cwp admin before run the script.
  • and now place the script in new file in your server and run it example: '/cpanelfix testuser' username as argument.
Code: [Select]
#!/bin/bash
if [ -z "$1" ]
then
"username argument not exist"
else
USERNAME="$1"
file="/home/cpmove-$USERNAME.tar.gz"
if [ -f "$file" ]
then
mkdir /home/"$USERNAME"/tmp/bkup
tar -C /home/"$USERNAME"/tmp/bkup -xzf "$file" */homedir/ --exclude='*/homedir/.*' --exclude='*/homedir/bin' --exclude='*/homedir/cpanel3-skel' --exclude='*/homedir/cpanelbranding' --exclude='*/homedir/etc' --exclude='*/homedir/logs' --exclude='*/homedir/mail' --exclude='*/homedir/perl' --exclude='*/homedir/perl5' --exclude='*/homedir/public_ftp' --exclude='*/homedir/rvadmin' --exclude='*/homedir/ssl' --exclude='*/homedir/tmp'
cp -rlf /home/"$USERNAME"/tmp/bkup/*/homedir/* /home/"$USERNAME"/ && rm -r /home/"$USERNAME"/tmp/bkup/*
else
echo "restoration file not exist"
fi
fi