사용자 도구

사이트 도구


linux:grive2

문서의 이전 판입니다!


grive2

PPA 설치

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive

Debian Build Package

sudo apt-get install git cmake build-essential libgcrypt20-dev \
    libyajl-dev libboost-all-dev libcurl4-openssl-dev libexpat1-dev \
    libcppunit-dev binutils-dev debhelper zlib1g-dev dpkg-dev \
    pkg-config libstdc++-7-dev
 
# 소스 압축푼 디렉토리로 이동(ext 파티션이어야 한다)
dpkg-buildpackage -j4
 
# 상위디렉토리에 deb 패키지 생성됨
sudo dpkg -i <filename.deb>

API 인증

  1. Go to https://console.developers.google.com/apis/library. Login with your Google account and create a new project on Google Cloud Platform. You can also use an existing one.
  2. Search for Google Drive API and enable it.
  3. Create a new OAuth Client credential. You will be provided with a id and a secret. Save both because you gonna need it for grive2.
  4. Then you need to follow this repo README, download grive2, build and install. Then run
grive -a --id [client id] --secret [client secret]
# id 는 긴코드값.apps.googleusercontent.com 형태이다.

On your Drive folder and it will probably work.

If you want to use your ID and secret to build grive2 instead of using above command, you can edit the keys in

grive2/grive/src/main.cc Lines 49 to 50 in 3929909

 const std::string default_id            = "615557989097-i93d4d1ojpen0m0dso18ldr6orjkidgf.apps.googleusercontent.com" ; 
 const std::string default_secret        = "xiM8Apu_WuRRdheNelJcNtOD" ; 

사용

  • 신규 동기화
    mkdir SyncDir # 신규 동기화 디렉토리 생성
    cd SyncDir
    grive -a # 신규 동기화 시작
  • 일단 디렉토리 동기화를 한 번 지정하면 해당 디렉토리에 인증 정보가 저장되어 grive 명령만으로 동기화를 수행한다.
  • 동기화
    # 동기화 대상 디렉토리에서
    cd SyncDir
    grive
     
    # 혹은
    grive -p /path/to/SyncDir
  • 지속적 동기화
    # /home/myhome/GoogleDrive 디렉토리를 매시 15분, 45분마다 동기화하고 로그를 /tmp/grivesync.log로 남긴다.
    15,45 * * * * /usr/bin/grive -p '/home/myhome/GoogleDrive' -V -l /tmp/grivesync.log
  • Options
    • -V : verbose
    • -l [/path/to/logfile.log] : 로깅
    • -a : 신규 동기화 인증
    • -p [/path/to/sync] : 동기화할 디렉토리 지정.
  • NTFS 파티션에서 오류가 발생했다. Linux Partition을 참조하여 /etc/fstab/의 해당 파티션 옵션에 fmask=111,uid=1000을 추가했더니 잘 작동했다.
linux/grive2.1574899140.txt.gz · 마지막으로 수정됨: 2019/11/28 08:59 저자 kwon37xi