堅(jiān)果云支持webdav,則可以在Linux下使用命令行或腳本將數(shù)據(jù)備份到堅(jiān)果云空間。
開(kāi)啟堅(jiān)果云WebDAV服務(wù)
“賬戶(hù)信息”--“安全選項(xiàng)”

2017-09-26_204945.png
方式1:使用cadaver客戶(hù)端
1. 安裝cadaver
[root@365linux ~]# yum install cadaver
2. 使用cadaver連接webdav服務(wù)器
[root@365linux ~]# cadaver https://dav.jianguoyun.com/dav/
Authentication required for nutstore on server `dav.jianguoyun.com':
Username: ******** #你的堅(jiān)果云賬戶(hù)
Password: ******** #你的應(yīng)用密碼
dav:/dav/> ls
Listing collection `/dav/': succeeded.
Coll: backup 0 Sep 22 16:54
*#使用put命令上傳文件,使用get命令下載文件,類(lèi)似于ftp命令行;*
*#使用help命令幫助。*
3. 配置非交互式登錄
[root@365linux ~]# vim .netrc
machine dav.jianguoyun.com
login ********* #你的堅(jiān)果云賬戶(hù)
password ******** #你的應(yīng)用密碼
# 用于測(cè)試上傳文件的命令文本
[root@365linux ~]# vim dav.txt
put iptables.sh
bye
[root@365linux ~]# cadaver https://dav.jianguoyun.com/dav/backup/ < dav.txt
dav:/dav/backup/> put iptables.sh
Uploading iptables.sh to `/dav/backup/iptables.sh':
Progress: [=============================>] 100.0% of 1169 bytes succeeded.
dav:/dav/backup/> bye
Connection to `dav.jianguoyun.com' closed.

2017-09-26_211445.png
方式2:使用davfs掛載webdav目錄
1. 安裝davfs2
[root@365linux ~]# yum install -y davfs2
2.配置davfs2
davfs2和堅(jiān)果云的webdav協(xié)議有兼容性問(wèn)題,默認(rèn)掛載davfs會(huì)報(bào)錯(cuò)如下:
mount.davfs: mounting failed; the server does not support WebDAV
[root@365linux ~]# vim /etc/davfs2/davfs2.conf
ignore_dav_header 1
3. 配置非交互式掛載
[root@365linux ~]# vim /etc/davfs2/secrets
https://dav.jianguoyun.com/dav/backup 你的堅(jiān)果云賬戶(hù) 你的webdav應(yīng)用密碼
[root@365linux ~]# mount.davfs
https://dav.jianguoyun.com/dav/backup /mnt
[root@365linux ~]# ls /mnt
iptables.sh lost+found
$ echo "hello world"
延伸
通過(guò)堅(jiān)果云提供的webdav的接口,編寫(xiě)備份數(shù)據(jù)和自動(dòng)上傳的腳本,實(shí)現(xiàn)自動(dòng)備份Linux系統(tǒng)數(shù)據(jù)文件到堅(jiān)果云空間。反之也可以在windows、mac系統(tǒng)使用堅(jiān)果云客戶(hù)端同步文件到Linux系統(tǒng)。