Nhà cung cấp Tên miền, Hosting Uy Tín. Hỗ trợ 24/7

Hướng dẫn backup dữ liệu lên Google Drive trên vps sử dụng hệ điều hành CentOS

Lượt xem: 967 Thảo Luận: 2

     Xin chào tất cả các bạn hôm nay mình sẽ hướng dẫn các bạn các bước thực hiện backup dữ liệu trên google drive lên vps của bạn

     1) Tải files thực ghi của Google Drive thông qua dòng lệnh như sau

Các bạn đăng nhập vào vps và cài wget đầu tiên

Cài đặt wget 

Yum install wget –y

Sau đó

Wget –O drive https://drive.google.com/uc?id=0B3X9GIR6EmbnMHBMVWtKaEZXdDg

Mv drive /us/sbin/drive

Chmod 755 /usr/sbin/drive

 

     2) Thực thi file gdrive và lấy token của tài khoản Gmail

Bạn chỉ cần gõ drive vào vps, file sẽ trả về đường dẫn dạng 

https://accounts.google.com/o/oauth2/auth?client_id=367116221053-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state

Mở trình duyệt ra và copy link trên vào thanh địa chỉ, và đăng nhập với tài khoản google drive của bạn .

Bạn sẽ nhận được mã token sau khi xác nhận cho phép tương tác tới dịch vụ Google Drive

Copy mã token về cửa sổ SSH

4/xgC2z7HfLKaQK6yb1XFjMNJI-HQ4O4zTho-XgxcywuFY3KKc5fdZqX8

Vậy là bạn đã thực hiện xong việc cho phép VPS kết nối tới tài khoản Google Drive của bạn

     3) Tạo script upload như sau:

Gõ lệnh

Vi /root/autobackup.sh

 Copy nội dung sau

#!/bin/bash

LOCALFOLDER=/backup

GFOLDERID=0B278-U7RtCDieJ8rYmNudkkwQWM

For I in $(ls $LOCALFOLDER}

Do

Drive upload –file /backup/$i –p $GFOLDERID

done

Trong đó

LOCALFOLDER là vị trí folder chứa files backup của bạn

GFOLDERID là ID folder sẽ lưu trữ file backup của bạn

     3.a) Cách lấy Google Drive Folder ID

– Đăng nhập vào tài khoản google drive của bạn, và tạo folder

– Sau khi tạo folder xong, click đúp vào folder đó để mở folder. Lúc này trên thanh địa chỉ sẽ là Google Drive Folder ID của bạn, copy Google Drive Folder ID về file script

 

 

*** Sau khi hoàn thành các phần khai báo bạn, ấn lần lượt các phím sau “Ctrl + X“, Y , [Enter] để lưu lại files thực thi

    4) Đặt lịch tự động backup bằng cách gõ lệnh sau vào khung cửa sổ SSH

Echo “0 4 */7 * * sh /root/autobackup.sh”>>/etc/crontab

Lệnh này sẽ thực thi file backup 7 ngày một lần vào 4h sáng.

     Chúc các bạn thành công.

Tags: ,

Bình luận

cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet grandpashabet güncel giriş grandpashabet giriş grandpashabet grandpashabet güncel giriş grandpashabet giriş grandpashabet grandpashabet güncel giriş grandpashabet giriş grandpashabet grandpashabet güncel giriş grandpashabet giriş grandpashabet wbahis güncel giriş wbahis giriş wbahis wbahis wbahis güncel giriş wbahis giriş wbahis wbahis robinbet güncel giriş robinbet giriş robinbet robinbet robinbet güncel giriş robinbet giriş robinbet robinbet robinbet güncel giriş robinbet giriş robinbet robinbet timebet güncel giriş timebet giriş timebet timebet betsilin güncel giriş betsilin giriş betsilin betsilin betsilin güncel giriş betsilin giriş betsilin betsilin avrupabet güncel giriş avrupabet giriş avrupabet avrupabet avrupabet güncel giriş avrupabet giriş avrupabet avrupabet betpas güncel giriş betpas giriş betpas betpas betpas güncel giriş betpas giriş betpas betpas casinoroys güncel giriş casinoroys giriş casinoroys casinoroys casinoroys güncel giriş casinoroys giriş casinoroys casinoroys parmabet güncel giriş parmabet giriş parmabet parmabet parmabet güncel giriş parmabet giriş parmabet parmabet süratbet güncel giriş süratbet giriş süratbet süratbet süratbet güncel giriş süratbet giriş süratbet süratbet galyabet güncel giriş galyabet giriş galyabet galyabet galyabet güncel giriş galyabet giriş galyabet galyabet betwoon güncel giriş betwoon giriş betwoon betwoon betwoon güncel giriş betwoon giriş betwoon betwoon norabahis güncel giriş norabahis giriş norabahis norabahis norabahis güncel giriş norabahis giriş norabahis norabahis timebet güncel giriş timebet giriş timebet timebet timebet güncel giriş timebet giriş timebet timebet robinbet güncel giriş robinbet giriş robinbet robinbet robinbet güncel giriş robinbet giriş robinbet robinbet jojobet güncel giriş jojobet giriş jojobet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet betcio güncel giriş betcio giriş betcio betcio güncel giriş betcio giriş betcio cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet bahislion güncel giriş bahislion giriş bahislion jojobet güncel giriş jojobet giriş jojobet jojobet güncel giriş jojobet giriş jojobet betcio güncel giriş betcio giriş betcio betcio güncel giriş betcio giriş betcio cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet cratosroyalbet güncel giriş cratosroyalbet giriş cratosroyalbet cratosroyalbet grandpashabet güncel giriş grandpashabet giriş grandpashabet