[cyberpanel] Backup to Google Drive

5/5 - (2 bình chọn)

Due to great user interest and the most voted feature requests, CyberPanel added the option to save backups to Google Drive in version 2.0.2.

[cyberpanel] Backup to Google Drive

You can configure multiple Google Drive accounts and configure each account with different or the same websites for backup.

Backup using the web interface


1. Login to your Cyberpanel

Use your Cyberpanel credentials to login


2. Go to Backup → Set up Google Drive

Backup to Google Drive
Backup to Google Drive

3. Click vào “Setup new account”

Backup to Google Drive
Backup to Google Drive

4. In the pop-up box, enter whatever name you want to use

Backup to Google Drive
Backup to Google Drive

5. Allow CyberPanel to save backups to your Google Drive

You will have to sign in to your Google account if you are not already signed in

Backup to Google Drive
Backup to Google Drive

6. Confirm again

Backup to Google Drive
Backup to Google Drive

7. You will be redirected back to the Google drive setup screen, select the account you created in step 4

 

 


8. Select the backup frequency and the site you want to backup and click Add Site

 

CyberPanel provides a View Logs option   that can be used to check the details of the backup and transfer process to Google Drive

 

Web Backup on Cyberpanel with Comand Line

In addition to using the web interface as above, you can use comand line in combination with rclone to configure automatic backup of web sites on your server, prepare! Let’s start

  1. Connect SSH to your Server and make sure you access as root
  2. If you haven’t installed and configured remote cloud, refer to our guide, and name it remote.
  3. Next create a file named backup.sh in the /root  directory on your server by running the following command:
    sudo apt-get install curl
  4. Paste the following command into the newly created file (current interface):
    #!/bin/bash
    TIMESTAMP=$(date +"%F")
    SERVER_NAME=CHIASEDEV_BACKUP
    BACKUP_DIR="/home/backup"
    SECONDS=0
    
    echo "Remove why luu cu"
    rm -rf /home/*/backup/* /var/log/journal/*/*.journal $BACKUP_DIR && mkdir -p "$BACKUP_DIR/$DATE"
    wait
    
    
    echo "Bat dau sao luu Website";
    ls -1 /home -Icyberpanel -Idocker -Ibackup -Ilscache -Ivmail | while read user; do
    echo "--- Taking backup of $user ---";
    cyberpanel createBackup --domainName $user > /dev/null
    done
    echo "Backup done";
    echo '';
    echo "Move data"
    mv /home/*/backup/*.tar.gz "$BACKUP_DIR/$TIMESTAMP"
    wait
    echo "Move Website Curved Bar"
    
    echo "I'm sorry";
    /usr/sbin/rclone move $BACKUP_DIR "remote:$SERVER_NAME/$TIMESTAMP" >> /var/log/rclone.log 2>&1
    # Clean up
    rm -rf $BACKUP_DIR
    /usr/sbin/rclone -q --min-age 4w delete "remote:$SERVER_NAME" #Remove all backups older than 2 week
    /usr/sbin/rclone -q --min-age 24w rmdirs "remote:$SERVER_NAME" #Remove all empty folders older than 2 week
    /usr/sbin/rclone cleanup "remote:" #Cleanup Trash
    rm -rf $BACKUP_DIR
    echo "Welcome back";
    echo '';
    
    duration=$SECONDS
    echo "Complete $size, complete in $(($duration / 60)) minutes and $(($duration % 60)) seconds."
  5. You press Ctrl + X and Y respectively to complete.
  6. You run the following command to give the executable permission to the newly created file:
    chmod +x /root/backup.sh
  7. You can then run the following command to proceed later to save the entire system and upload them to Google Drive automatically:
    sudo bash /root/backup.sh

That’s the thing. You have successfully set up periodic backups to your Google Drive. CyberPanel makes it easy to set up backups directly to Google drive in less than 5 minutes. Hope this article will help you to ensure the security of your website. Don’t forget to leave a comment if you have difficulty in the process.

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *