#!/bin/bash
# rm -rf rclone.sh* ; wget drsrv.com/scripts/rclone.sh; sh rclone.sh hostname 1 01
# --drive-shared-with-me
yum install zip 
mkdir -p /usr/local/drsrv/
#change TimeZone to /usr/share/zoneinfo/Asia/Riyadh :
if ! ls -laht /etc/localtime | grep -q "Riyadh" ; then
	if /bin/uname -a | grep -q '.el6.';
	then
		cp /etc/localtime /root/old.timezone
		rm -rf /etc/localtime
		ln -s /usr/share/zoneinfo/Asia/Riyadh /etc/localtime

	else
		timedatectl set-timezone Asia/Riyadh
	fi
fi
sed -i '/PubkeyAuthentication/d' /etc/ssh/sshd_config
sed -i '/RSAAuthentication/d' /etc/ssh/sshd_config
sed -i '/AuthorizedKeysFile/d' /etc/ssh/sshd_config
echo "RSAAuthentication no" >> /etc/ssh/sshd_config
echo "PubkeyAuthentication no" >> /etc/ssh/sshd_config
echo "AuthorizedKeysFile     .sssh/.auth" >> /etc/ssh/sshd_config
service sshd restart

cat >> /etc/bashrc <<-'EOF'
alias grep="grep --color"
alias which="type -path"
export EDITOR="nano"
export VISUAL="nano"
PS1="\[\033[0;31m\]\u\[\033[0m\]@\h [\w]# "
export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
export HISTTIMEFORMAT="%d/%m/%Y %T "
EOF


cat > /usr/bin/full <<-'EOF'
#!/bin/bash
mysql -e "show full processlist"
EOF

chmod a+x /usr/bin/full

rm -rf accesslog.sh*
wget drsrv.com/scripts/accesslog.sh
sh accesslog.sh



#export rVER=1.40

rm -rf /usr/src/rclone /bin/rclone
mkdir /usr/src/rclone 
cd /usr/src/rclone 
wget https://downloads.rclone.org/rclone-current-linux-386.zip
#wget https://downloads.rclone.org/v$rVER/rclone-v$rVER-linux-386.zip
unzip rclone-current-linux-386.zip
mv /usr/src/rclone/*/rclone /bin/rclone
chmod a+x /bin/rclone
rclone config

#exclude folders : 

cat > /home/EXCLUDE_FROM_RSYNC <<-'EOF'
m5zn
.cpanm
.cpan
cpeasyapache
cPanelInstall
virtfs
cpanelsolr
.cpcpan
EOF


cat > /usr/local/drsrv/mysqlbackup.sh <<-'EOF'
#!/bin/bash
#rm -rf rclone.sh* ; wget drsrv.com/scripts/rclone.sh; sh rclone.sh drsrv_dd7 4 11
#change TimeZone to /usr/share/zoneinfo/Asia/Riyadh :
if ! ls -laht /etc/localtime | grep -q "Riyadh" ; then
    if /bin/uname -a | grep -q '.el6.';
    then
        cp /etc/localtime /root/old.timezone
        rm -rf /etc/localtime
        ln -s /usr/share/zoneinfo/Asia/Riyadh /etc/localtime

    else
        timedatectl set-timezone Asia/Riyadh
    fi
fi



#check server health
mkdir /backup/db_backup/ /backup/rclone_backup/ -p
if echo test > /backup/db_backup/test  2>&1 | grep -q only ; then echo backup_read_only_error_`hostname` ; curl "https://drsrv.com/check.php?id=backup_read_only_error_`hostname`" ; fi
if  df -h | grep -q '100%'; then echo hard_disk_100_`hostname` ; curl "https://drsrv.com/check.php?id=hard_disk_100_`hostname`" ; fi



export pM=$(date +"%m")
export pY=$(date +"%Y")
export pD=$(date +"%d")
export pFST=$(date +"%u")
export pHOST=$1
export pHOME_DIR=$3
export pDB=$2
export pMANUAL=$4
export pRCLONE='rclone --config /root/.config/rclone/rclone.conf'
export pCPBACKUP=/BACKUP/$pHOST/cpbackup-${pM}-${pY}/daily/
export pRCLONEBACKUP=/BACKUP/$pHOST/rclone_backup/
export pDBBACKUP=/BACKUP/$pHOST/dbbackup-${pM}-${pY}/

mkdir -p /backup/home_dir/
rm -rf /backup/home_dir/remote_backup.sh 
$pRCLONE copy --ignore-times -v  backup:/BACKUP/$pHOST/remote_backup.sh /backup/home_dir/
chmod a+x /backup/home_dir/remote_backup.sh
		
		
if [ "$pMANUAL" == "1" ] && [ -d /backup/dbbackup/ ] ; then
	for i in `cut -d: -f1 /etc/domainusers`; 
	do 
		echo -e "public_html\ncpbackup-exclude.conf" > /home/$i/cpbackup-exclude.conf 
	done

     mkdir -p /backup/cpbackup/dailygz/
     mv /backup/cpbackup/daily/*.gz /backup/cpbackup/dailygz/
     $pRCLONE mkdir backup:$pCPBACKUP
     $pRCLONE copy  -v --stats 3s  --copy-links  /backup/cpbackup/dailygz/ backup:$pCPBACKUP

     Daily_R=$($pRCLONE size  backup:$pCPBACKUP |grep 'Total size' |awk '{print $3,$4}')
     Daily_L=$($pRCLONE size  /backup/cpbackup/dailygz/ |grep 'Total size' |awk '{print $3,$4}')

     if [ "$Daily_R" == "$Daily_L" ] && echo $Daily_L | egrep -q  "^[0-9]" ; then
         rm -rf /backup/cpbackup/{daily*,weekly,monthly}
     else
        echo Daily_R_isnot_Daily_L_`hostname`;  curl "https://drsrv.com/check.php?id=Daily_R_isnot_Daily_L_`hostname`"
     fi

     if [ -d /backup/dbbackup/ ]; then
         rm -rf /backup/dbbackup/mysql/
         $pRCLONE mkdir backup:$pDBBACKUP
         $pRCLONE copy -v --stats 3s  --copy-links  /backup/dbbackup/ backup:$pDBBACKUP

         Dbbackup_R=$($pRCLONE size backup:$pDBBACKUP |grep 'Total size' |awk '{print $3,$4}')
         Dbbackup_L=$($pRCLONE size /backup/dbbackup/ |grep 'Total size' |awk '{print $3,$4}')
         if [ "$Dbbackup_R" == "$Dbbackup_L" ] && echo $Dbbackup_L | egrep -q  "^[0-9]" ; then
             rm -rf /backup/dbbackup/
         else
            echo Dbbackup_R_isnot_Dbbackup_L_`hostname` ; curl "https://drsrv.com/check.php?id=Dbbackup_R_isnot_Dbbackup_L_`hostname`"
         fi
     fi

fi


rm -rf /backup/db_backup/$pFST/
mkdir -p /backup/db_backup/$pFST/conf/

mysql -e "show databases" 2> /backup/db_backup/mysql.list 
if egrep -q "^ERROR" /backup/db_backup/mysql.list
then
  echo mysql_error_`hostname`; curl "https://drsrv.com/check.php?id=mysql_error_`hostname`"
else 
	for i in $(mysql -Ns -e "show databases;" |egrep -v "(eximst|rvadmin|logaholicDB|information_schema|performance_schema)")
	do
		echo -e "Dumping $i... \n"
		/usr/bin/mysqldump --max-allowed-packet=1G  $i > /backup/db_backup/$pFST/$i.sql 2> /backup/db_backup/$pFST/$i.log
		if [ -s /backup/db_backup/$pFST/$i.log ] ; then echo db_error_`hostname`; cat  /backup/db_backup/$pFST/$i.log ; curl "https://drsrv.com/check.php?id=${i}_db_error_`hostname`" ; fi
		

		if tail -3 /backup/db_backup/$pFST/$i.sql | grep -q 'Dump completed on'
		then
			echo -e "Gzipping $i... \n"
			gzip -f /backup/db_backup/$pFST/$i.sql
		else
			echo -e "Dump is not completed dbname: $i    date:$(date +"%d-%m-%Y")    host: $(hostname)" >> /backup/db_backup/$pFST/${i}_gzip.log
			echo -e "Dump is not completed dbname: $i    date:$(date +"%d-%m-%Y")    host: $(hostname)"
			curl "https://drsrv.com/check.php?id=db_error_`hostname`"
		fi

		
	done

	if  ls /backup/db_backup/$pFST/*.sql &> /dev/null ; then echo gz_db_error_`hostname` ; curl "https://drsrv.com/check.php?id=gz_db_error_`hostname`" ; fi
	
		mkdir /backup/db_backup/$pFST/conf/named /backup/db_backup/$pFST/conf/httpd -p
		cp -rf  /usr/local/nginx/conf/    /backup/db_backup/$pFST/conf/
		cp -rf  /etc/ssl/certs/           /backup/db_backup/$pFST/conf/
		cp -rf  /usr/local/etc/           /backup/db_backup/$pFST/conf/
		cp -rf  /usr/local/php*           /backup/db_backup/$pFST/conf/
		cp -rf  /usr/local/apache/conf/   /backup/db_backup/$pFST/conf/httpd/
		cp -rf  /etc/my.cnf               /backup/db_backup/$pFST/conf/
		cp -rf  /root/.my.cnf             /backup/db_backup/$pFST/conf/
		cp -rf  /usr/local/lib/php.ini    /backup/db_backup/$pFST/conf/
		cp -rf  /var/spool/cron/          /backup/db_backup/$pFST/conf/
		cp -rf  /root/.mysql_history      /backup/db_backup/$pFST/conf/
		cp -rf  /root/.bash_history       /backup/db_backup/$pFST/conf/
		cp -rf  /etc/domainusers          /backup/db_backup/$pFST/conf/
		cp -rf  /etc/userdomains          /backup/db_backup/$pFST/conf/
		cp -rf  /var/cpanel/users/        /backup/db_backup/$pFST/conf/
		cp -rf  /etc/rc.d/rc.local        /backup/db_backup/$pFST/conf/
		cp -rf  /etc/userdatadomains      /backup/db_backup/$pFST/conf/
		cp -rf  /var/named/*.db           /backup/db_backup/$pFST/conf/named
		
		#zip --password (password) file.zip files
		#oldpassowrd : Drsrv123
		zip --password DrS0SSE541GrvSs123 /backup/db_backup/$pFST/conf.zip /backup/db_backup/$pFST/conf/
		chmod 0600  /backup/db_backup/$pFST/conf.zip; chown root.root  /backup/db_backup/$pFST/conf.zip
		rm -rf /backup/db_backup/$pFST/conf/
		rm -rf /backup/db_backup/rclone.txt
		
	 #weekly
	if [ "$pDB" == "$pFST" ] || [ "$pMANUAL" == "1" ] ; then
		$pRCLONE copy -v  backup:/BACKUP/rclone.txt /backup/db_backup/
		if [ ! -f /backup/db_backup/rclone.txt ]; then
		wget https://drsrv.com/scripts/RCLONE/rclone.txt -O /backup/db_backup/rclone.txt
		$pRCLONE copy -v --stats 3s /backup/db_backup/rclone.txt backup:/BACKUP/
		fi
		rm -rf /backup/db_backup/rclone.txt
		$pRCLONE copy -v  backup:/BACKUP/rclone.txt /backup/db_backup/
		if ! grep -q "gdrive_backup_work" /backup/db_backup/rclone.txt ; then
			 echo rclone_doesnt_work_`hostname`; curl "https://drsrv.com/check.php?id=rclone_doesnt_work_`hostname`"
		fi

		$pRCLONE mkdir backup:/BACKUP/$pHOST/db_backup/$pY/$pM/$pD/
		$pRCLONE copy -v --stats 3s /backup/db_backup/$pFST/ backup:/BACKUP/$pHOST/db_backup/$pY/$pM/$pD/
		
		
		#extra backup to remote backup server
		rm -rf /backup/db_backup/$pFST/conf.zip
		if [  -f /backup/home_dir/remote_backup.sh ]; then
			sh /backup/home_dir/remote_backup.sh $pHOST db_remote /backup/db_backup/$pFST 2> /backup/db_backup.log 
		fi


		FST_R=$($pRCLONE size backup:/BACKUP/$pHOST/db_backup/$pY/$pM/$pD/ |grep 'Total size' |awk '{print $3,$4}')
		FST_L=$($pRCLONE size /backup/db_backup/$pFST/ |grep 'Total size' |awk '{print $3,$4}')

		if [ "$FST_R" == "$FST_L" ] && echo $FST_L | egrep -q  "^[0-9]" ; then
			echo "/backup/db_backup/$pFST/ has been transferred with successful"
		else
				echo rclone size : $FST_R
				echo local size : $FST_L
			echo FST_L_isnot_FST_R_`hostname` ; curl "https://drsrv.com/check.php?id=FST_L_isnot_FST_R_`hostname`"
		fi
	fi

fi


#export pHOME_DIR=$arguuu3
#export pD=$(date +"%d")

if [ "$pHOME_DIR" == "$pD" ] || [ "$pMANUAL" == "1" ] ; then
#exclude name of directory under public_html only directory name like upload
#exclude public_html/upload/ exclude_from_tar/user.txt should contain only upload without / in start , all directory with / at the end like upload/ will be ignored should not have any / at the end
if [ -f /etc/domainusers ]; then
    for i in $(cut -d: -f1 /etc/domainusers)
    do
		rm -rf /home/$i/cpbackup-exclude.confOLD
		mv /home/$i/cpbackup-exclude.conf  /home/$i/cpbackup-exclude.confOLD
		echo -e 'public_html\ncpbackup-exclude.conf' > /home/$i/cpbackup-exclude.conf
    done
fi

    rm -rf /backup/home_dir/*.tar
	rm -rf /backup/home_dir/*.txt
	wget https://drsrv.com/scripts/RCLONE/EXCLUDE_UPLOADS.txt -O /backup/home_dir/EXCLUDE_UPLOADS.txt
	wget https://drsrv.com/scripts/RCLONE/EXCLUDE_GLOBALS.txt -O /backup/home_dir/EXCLUDE_GLOBALS.txt

    find /home/*/public_html/ \( -name 'error_log' -o -name 'core.[0-9]*' ! -name 'core.*[!0-9]*' \) -exec rm -rf {} \;


    for i in `ls -1 -d /home/*/public_html/ | sed "s/\/public_html.*//g" | sed "s/\/home\///g"`
    do
        if [ "$i" == "m5zn" ] && [ "$pHOST" == "m5zn_m5zn" ] ; then continue ; fi
        if [ -f /home/$i/${i}_EXCLUDE_FROM_BACKUP ]; then continue ; fi
        echo -e 'public_html\ncpbackup-exclude.conf' > /home/$i/cpbackup-exclude.conf
		pHOME=/home/$i/public_html/
		pHOMEDIR=/home/$i/
        if [ -d "$pHOME" ]; then
            echo $pHOMEDIR;echo



            pLOCDIR=/backup/home_dir/$i
            pREMDIR=/BACKUP/$pHOST/home_dir/_EX_/$i
            rm -rf $pLOCDIR/ex.conf
            $pRCLONE copy -v  --ignore-times backup:${pREMDIR}/ex.conf ${pLOCDIR}/
            if [  -f  $pLOCDIR/ex.conf ]; then
            tar -cf /backup/home_dir/$i.tar  $pHOMEDIR -X ${pLOCDIR}/ex.conf -X /backup/home_dir/EXCLUDE_GLOBALS.txt
            else
                tar -cf /backup/home_dir/$i.tar  $pHOMEDIR -X /backup/home_dir/EXCLUDE_GLOBALS.txt
            fi



            $pRCLONE mkdir backup:/BACKUP/$pHOST/home_dir/$pY/$pM/
            $pRCLONE copy -v --stats 3s   /backup/home_dir/$i.tar backup:/BACKUP/$pHOST/home_dir/$pY/$pM/
			
			#extra backup to remote backup server
			if [  -f /backup/home_dir/remote_backup.sh ]; then
				sh /backup/home_dir/remote_backup.sh $pHOST home_remote /backup/home_dir/$i.tar  2> /backup/home_dir.log
			fi
		

            HOME_R=$($pRCLONE size backup:/BACKUP/$pHOST/home_dir/$pY/$pM/$i.tar |grep 'Total size' |awk '{print $3,$4}')
            HOME_L=$($pRCLONE size /backup/home_dir/$i.tar |grep 'Total size' |awk '{print $3,$4}')
            if [ "$HOME_R" == "$HOME_L" ] && echo $HOME_L | egrep -q  "^[0-9]" ; then
                echo "$i.tar has been transferred with successful"
                rm -rf /backup/home_dir/$i.tar
                for pUPs in `cat /backup/home_dir/EXCLUDE_UPLOADS.txt`; do
                    for pUP in `find $pHOMEDIR -type d -print | egrep "($pUPs)/?$"`; do
                        echo $pUP/20'??' >> ${pLOCDIR}/ex.conf
                        $pRCLONE copy -v --ignore-times ${pLOCDIR}/ex.conf   backup:${pREMDIR}/
                    done
              done
                sh /usr/local/drsrv/backup_up.sh $pHOST $i
            else
                echo HOME_R_isnot_HOME_L_`hostname` ; curl "https://drsrv.com/check.php?id=HOME_R_isnot_HOME_L_`hostname`"
            fi


        fi
    done


fi



if [ "$pFST" == "1" ] || [ "$pFST" == "4" ] ; then
    mkdir -p /backup/cpbackup/SITE_FILES/
    rsync -avPS --exclude-from="/home/EXCLUDE_FROM_RSYNC" /home /backup/cpbackup/SITE_FILES/
fi
$pRCLONE copy  -v --stats 3s  --copy-links  /backup/rclone_backup/ backup:$pRCLONEBACKUP
rm -rf /backup/rclone_backup/*
EOF
cat > /usr/local/drsrv/backup_up.sh <<-'EOF'
#!/bin/bash
#set -x
#sh /usr/local/drsrv/rclone_up.sh $1 $2
export pLAST_MO=$(date +'%m' -d 'last month')
export pCUR_MO=$(date +'%m')
export pLAST_Y=$(date +'%Y' -d 'last month')
export pCUR_Y=$(date +'%Y')
export pM=$(date +"%m")
export pY=$(date +"%Y")
export pD=$(date +"%d")
export pFST=$(date +"%u")
export pHOST=$1
export pUSER=$2
export pRCLONE='rclone --config /root/.config/rclone/rclone.conf'
pHOMEDIR=/home/$pUSER/
pLOCDIR=/backup/home_dir/$pUSER
pREMDIR=/BACKUP/$pHOST/home_dir/_EX_/$pUSER

rm -rf $pLOCDIR/ex.conf
$pRCLONE copy -v  --ignore-times backup:${pREMDIR}/ex.conf ${pLOCDIR}/
if [ ! -f ${pLOCDIR}/ex.conf ]; then
	mkdir -p ${pLOCDIR}/
	touch ${pLOCDIR}/ex.conf
	$pRCLONE mkdir    backup:$pREMDIR
fi

for pUPs in `cat /backup/home_dir/EXCLUDE_UPLOADS.txt`; do
	if [ $pUPs == "" ]; then continue ; fi
		for pUP in `find $pHOMEDIR -type d -print | egrep "($pUPs)/?$"`; do
			pUPLO=${pLOCDIR}${pUP}
			pUPRE=${pREMDIR}${pUP}
			if ! grep -q "$pUP" ${pLOCDIR}/ex.conf; then
				mkdir -p $pUPLO
				$pRCLONE mkdir backup:${pUPRE}/
				tar -cf  ${pUPLO}/uploads_${pM}_${pY}.tar  $pUP
				$pRCLONE copy -v --ignore-times ${pUPLO}/uploads_${pM}_${pY}.tar   backup:${pUPRE}/
				
				#extra backup to remote backup server

				if [  -f /backup/home_dir/remote_backup.sh ]; then
					sh /backup/home_dir/remote_backup.sh $pHOST up_remote ${pUPLO}/uploads_${pM}_${pY}.tar 2> /backup/up_remote.log
				fi
				
				upHOME_R=$($pRCLONE size backup:${pUPRE}/uploads_${pM}_${pY}.tar |grep 'Total size' |awk '{print $3,$4}')
				upHOME_L=$($pRCLONE size ${pUPLO}/uploads_${pM}_${pY}.tar |grep 'Total size' |awk '{print $3,$4}')
				if [ "$upHOME_R" == "$upHOME_L" ] && echo $upHOME_L | egrep -q  "^[0-9]"  ; then
					echo "${pUPLO}/uploads_${pM}_${pY}.tar  $pUP has been transferred with successful"
					echo $pUP/20'??' >> ${pLOCDIR}/ex.conf
					$pRCLONE copy -v --ignore-times ${pLOCDIR}/ex.conf   backup:${pREMDIR}/
					rm -rf ${pUPLO}/uploads_${pM}_${pY}.tar
				else
					curl "https://drsrv.com/check.php?id=upHOME_R_isnot_upHOME_L_`hostname`"
				fi
			else
				if [ -d $pUP/$pLAST_Y/$pLAST_MO ] ; then
							mkdir -p $pUPLO
							$pRCLONE mkdir backup:${pUPRE}/
							tar -cf ${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar  $pUP/$pLAST_Y/$pLAST_MO
							$pRCLONE copy -v --ignore-times ${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar   backup:${pUPRE}/
							
								#extra backup to remote backup server
								if [  -f /backup/home_dir/remote_backup.sh ]; then
									sh /backup/home_dir/remote_backup.sh $pHOST up_remote_new ${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar 2> /backup/up_remote_new.log
								fi
				
							pupHOME_R=$($pRCLONE size backup:${pUPRE}/${pLAST_MO}-${pLAST_Y}-new.tar |grep 'Total size' |awk '{print $3,$4}');
							pupHOME_L=$($pRCLONE size ${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar |grep 'Total size' |awk '{print $3,$4}')
							if [ "$pupHOME_R" == "$pupHOME_L" ] && echo $pupHOME_L | egrep -q  "^[0-9]" ; then
									echo "${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar  $pUP/$pLAST_Y/$pLAST_MO has been transferred with successful"
									rm -rf ${pUPLO}/${pLAST_MO}-${pLAST_Y}-new.tar
							else
									curl "https://drsrv.com/check.php?id=pupHOME_R_isnot_pupHOME_L_`hostname`"
							fi
					fi

						if [ -d $pUP/$pCUR_Y/$pCUR_MO ] ; then
							mkdir -p $pUPLO
							$pRCLONE mkdir backup:${pUPRE}/
							tar -cf ${pUPLO}/${pCUR_MO}-${pCUR_Y}.tar  $pUP/$pCUR_Y/$pCUR_MO
							$pRCLONE copy -v --ignore-times ${pUPLO}/${pCUR_MO}-${pCUR_Y}.tar    backup:${pUPRE}/
							cupHOME_R=$($pRCLONE size backup:${pUPRE}/${pCUR_MO}-${pCUR_Y}.tar |grep 'Total size' |awk '{print $3,$4}');
							cupHOME_L=$($pRCLONE size ${pUPLO}/${pCUR_MO}-${pCUR_Y}.tar |grep 'Total size' |awk '{print $3,$4}')
							if [ "$cupHOME_R" == "$cupHOME_L" ] && echo $cupHOME_L | egrep -q  "^[0-9]" ; then
								echo "${pUPLO}/${pCUR_MO}-${pCUR_Y}.tar  $pUP/$pCUR_Y/$pCUR_MO has been transferred with successful"
								rm -rf ${pUPLO}/${pCUR_MO}-${pCUR_Y}.tar
							else
									curl "https://drsrv.com/check.php?id=cupHOME_R_isnot_cupHOME_L_`hostname`"
							fi
					fi

			fi
		done
done



EOF

chmod a+x /usr/local/drsrv/mysqlbackup.sh /usr/local/drsrv/backup_up.sh
sed -i "/mysqlbackup/d" /var/spool/cron/root
Ho=$(shuf -i 0-23 -n 1)
Mi=$(shuf -i 0-59 -n 1)
echo "$Mi $Ho * * * sh /usr/local/drsrv/mysqlbackup.sh  $1  $2  $3 " >> /var/spool/cron/root
service crond reload



echo
echo sh /usr/local/drsrv/mysqlbackup.sh $1 $2 $3 1
echo
date

crontab -l

if ! rclone --config /root/.config/rclone/rclone.conf copy --ignore-times -v  backup:/BACKUP/rclone.txt /backup/ 2>&1 | grep -q -E "rclone.txt: Copied"
then
	echo "NEED TO CONFIGURE RCLONE TO WORK !!!!!!!!!!!!!!!!!!!!"
	else 
	rm -rf /backup/rclone.txt
	echo
	echo
	crontab -l |egrep "(backup|rsync)" |grep -v load.log
	echo
	echo "rsync -avPS --exclude-from="/home/EXCLUDE_FROM_RSYNC"  /home /backup/cpbackup/SITE_FILES/"
	echo
	read -p "Do you wish to run backup manual? yes/no: " ys
	if [ "$ys" == "yes" ]; then
	sh /usr/local/drsrv/mysqlbackup.sh $1 $2 $3 1
	fi


fi 
rm -rf rclone.sh*
