久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Debian怎么使用rclone掛載google drive

195次閱讀
沒有評論

共計 4970 個字符,預計需要花費 13 分鐘才能閱讀完成。

這篇文章主要講解了“Debian 怎么使用 rclone 掛載 google drive”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著丸趣 TV 小編的思路慢慢深入,一起來研究和學習“Debian 怎么使用 rclone 掛載 google drive”吧!

Debian/Ubuntu

# 安裝 rclone

nano rclone.sh

輸入下列內容,并保存

#!/bin/bash
 
apt-get install -y nload htop fuse p7zip-full
 
KernelBit= $(getconf LONG_BIT) 
[[  $KernelBit  ==  32  ]]   KernelBitVer= i386 
[[  $KernelBit  ==  64  ]]   KernelBitVer= amd64 
[[ -z  $KernelBitVer  ]]   exit 1
cd /tmp
wget -O  /tmp/rclone.zip   https://downloads.rclone.org/rclone-current-linux-$KernelBitVer.zip 
7z x /tmp/rclone.zip
cd rclone-*
cp -raf rclone /usr/bin/
chown root:root /usr/bin/rclone
chmod 755 /usr/bin/rclone
mkdir -p /usr/local/share/man/man1
cp -raf rclone.1 /usr/local/share/man/man1/
mandb

執行

bash rclone_debian

# 初始化配置

rclone config

n) New remote

s) Set configuration password

q) Quit config

n/s/q n

name gdrive  #隨便填,后面要用到

Type of storage to configure.

Choose a number from below, or type in your own value

 1 / Amazon Drive

    amazon cloud drive

 2 / Amazon S3 (also Dreamhost, Ceph, Minio)

    s3

 3 / Backblaze B2

    b2

 4 / Box

    box

 5 / Cache a remote

    cache

 6 / Dropbox

    dropbox

 7 / Encrypt/Decrypt a remote

    crypt

 8 / FTP Connection

    ftp

 9 / Google Cloud Storage (this is not Google Drive)

    google cloud storage

10 / Google Drive

    drive

11 / Hubic

    hubic

12 / Local Disk

    local

13 / Microsoft Azure Blob Storage

    azureblob

14 / Microsoft OneDrive

    onedrive

15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)

    swift

16 / Pcloud

    pcloud

17 / QingCloud Object Storage

    qingstor

18 / SSH/SFTP Connection

    sftp

19 / Webdav

    webdav

20 / Yandex Disk

    yandex

21 / http Connection

    http

Storage 10  #選擇 10,Google Drive

Google Application Client Id – leave blank normally.

client_id   #留空  

Google Application Client Secret – leave blank normally.

client_secret   #留空

Service Account Credentials JSON file path – needed only if you want use SA instead of interactive login.

service_account_file  

Remote config

Use auto config?

 * Say Y if not sure

 * Say N if you are working on a remote or headless machine or Y didn t work

y) Yes

n) No

y/n n  #選擇 n

If your browser doesn t open automatically go to the following link: https://accounts.google.com/o/oauth2/auth….  #復制到瀏覽器打開,獲取驗證碼

Log in and authorize rclone for access

Enter verification code   #填入上面獲取到的驗證碼

Configure this as a team drive?

y) Yes

n) No

y/n y  #選擇 y

Fetching team drive list…

No team drives found in your account——————–

[dengxj]

client_id = 

client_secret = 

service_account_file = 

token = {access_token : ya29.GltFBd7UJN2qrxdG8FnG_rMuB18ogb8QlujdL7glvXtfV}

team_drive = 

——————–

y) Yes this is OK

e) Edit this remote

d) Delete this remote

y/e/d y  #選擇 y

Current remotes:

Name                 Type

====                 ====

dengxj               drive

e) Edit existing remote

n) New remote

d) Delete remote

r) Rename remote

c) Copy remote

s) Set configuration password

q) Quit config

e/n/d/r/c/s/q q  #選擇 q 退出

掛載為磁盤

# 新建本地文件夾,路徑自己定,即下面的 LocalFolder

mkdir /root/GoogleDrive

# 掛載為磁盤

格式:

rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

我們這里可以這樣填

rclone mount gdrive: /root/GoogleDrive –allow-other –allow-non-empty –vfs-cache-mode writes

如需卸載磁盤

fusermount -qzu LocalFolder

三、自啟動

(1)下載并編輯腳本

nano rcloned

輸入下面內容

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
NAME_BIN= rclone 
### BEGIN INIT INFO
# Provides: rclone
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start rclone at boot time
# Description: Enable rclone by daemon.
### END INIT INFO
NAME=  #rclone name 名
REMOTE=  # 遠程文件夾
LOCAL=  # 掛載地址
Green_font_prefix= [32m    Red_font_prefix= [31m    Green_background_prefix= [42;37m    Red_background_prefix= [41;37m    Font_color_suffix= [0m 
Info= ${Green_font_prefix}[信息]${Font_color_suffix} 
Error= ${Red_font_prefix}[錯誤]${Font_color_suffix} 
RETVAL=0
check_running(){PID= $(ps -C $NAME_BIN -o pid= |head -n1 |grep -o  [0-9]{1,} ) 
if [[ ! -z ${PID} ]]; then
return 0
return 1
do_start(){
check_running
if [[ $? -eq 0 ]]; then
echo -e  ${Info} $NAME_BIN (PID ${PID})  正在運行...    exit 0
fusermount -zuq $LOCAL  /dev/null 2 1
mkdir -p $LOCAL
sudo /usr/bin/rclone mount $NAME:$REMOTE $LOCAL --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000  /dev/null 2 1  
sleep 2s
check_running
if [[ $? -eq 0 ]]; then
echo -e  ${Info} $NAME_BIN  啟動成功  ! 
echo -e  ${Error} $NAME_BIN  啟動失敗  ! 
do_stop(){
check_running
if [[ $? -eq 0 ]]; then
kill -9 ${PID}
RETVAL=$?
if [[ $RETVAL -eq 0 ]]; then
echo -e  ${Info} $NAME_BIN  停止成功  ! 
echo -e  ${Error} $NAME_BIN  停止失敗  ! 
echo -e  ${Info} $NAME_BIN  未運行 
RETVAL=1
fusermount -zuq $LOCAL  /dev/null 2 1
do_status(){
check_running
if [[ $? -eq 0 ]]; then
echo -e  ${Info} $NAME_BIN (PID $(echo ${PID}))  正在運行... 
echo -e  ${Info} $NAME_BIN  未運行  ! 
RETVAL=1
do_restart(){
do_stop
do_start
case  $1  in
start|stop|restart|status)
do_$1
echo  使用方法: $0 { start | stop | restart | status } 
RETVAL=1
exit $RETVAL

修改其中的

NAME= #rclone name 名,及配置時輸入的 Name

REMOTE=’’#遠程文件夾,Google Drive 網盤里的掛載的一個文件夾

LOCAL=’’#掛載地址,VPS 本地掛載目錄

然后

#Debian 系統

apt-get install sudo -y

# 設置自啟

mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
update-rc.d -f rcloned defaults
bash /etc/init.d/rcloned start

感謝各位的閱讀,以上就是“Debian 怎么使用 rclone 掛載 google drive”的內容了,經過本文的學習后,相信大家對 Debian 怎么使用 rclone 掛載 google drive 這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是丸趣 TV,丸趣 TV 小編將為大家推送更多相關知識點的文章,歡迎關注!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-15發表,共計4970字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 分宜县| 大英县| 中西区| 江达县| 两当县| 云龙县| 金寨县| 安泽县| 五华县| 雷州市| 东乌珠穆沁旗| 高碑店市| 德清县| 仁布县| 高邮市| 大邑县| 怀宁县| 西安市| 潍坊市| 安顺市| 苗栗县| 泰兴市| 巴林左旗| 陆河县| 宣恩县| 瑞丽市| 巫山县| 罗平县| 盐源县| 类乌齐县| 淳化县| 达日县| 金沙县| 保康县| 象山县| 台东县| 喜德县| 武安市| 雷山县| 龙井市| 道真|