Control Web Panel

WebPanel => CentOS-WebPanel Bugs => Topic started by: YOUSSEF on August 29, 2019, 11:05:08 PM

Title: cPanel Account Restore - subdomains directories
Post 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:
Code: [Select]
/home/testacc/test.example.com/ has only default index page of cwp and not files from restoration file.
Title: Re: cPanel Account Restore - subdomains directories
Post by: YOUSSEF 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 :
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