Control Web Panel
WebPanel => CentOS-WebPanel Bugs => Topic started by: YOUSSEF 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:
/home/testacc/test.example.com/
has only default index page of cwp and not files from restoration file.
-
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.
#!/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