美文网首页
Cookbook: 使用Dropbox做数据备份

Cookbook: 使用Dropbox做数据备份

作者: 乃铭 | 来源:发表于2018-06-23 10:50 被阅读98次

首先在Linux上安装Dropbox,不同操作系统执行以下命令:
32-bit:

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -

64-bit:

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

安装好之后发现家目录下并没有新增文件?
其实是有新增的,被隐藏在.dropbox-dist。

~/.dropbox-dist/dropboxd

执行上面这个程序用于关联账户,第一次执行会给出如下链接。
在浏览器中打开此链接即可自动关联你的Dropbox账户。

This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=xxxx to link this device.

关联好之后Dropbox文件夹会出现在你的家目录中:

 ll | grep Dropbox
drwx------ 3 xxx xxx   4096 Jun 23 10:44 Dropbox

接下来下载一个python 脚本Python script控制Dropbox,替代~/.dropbox-dist/dropboxd

~ python dropbox.py
Dropbox command-line interface

commands:

Note: use dropbox help <command> to view usage for a specific command.

 status       get current status of the dropboxd
 throttle     set bandwidth limits for Dropbox
 help         provide help
 stop         stop dropboxd
 running      return whether dropbox is running
 start        start dropboxd
 filestatus   get current sync status of one or more files
 ls           list directory contents with current sync status
 autostart    automatically start dropbox at login
 exclude      ignores/excludes a directory from syncing
 lansync      enables or disables LAN sync
 sharelink    get a shared link for a file in your dropbox
 proxy        set proxy settings for Dropbox

Tips: 即便之前在本地没有生成Dropbox目录,执行如下脚本成功后,仍可以生成Dropbox目录。

python dropbox.py start
 python dropbox.py status
Up to date

Dropbox 程序正在运行,且已同步。此时把文件移动到Dropbox目录中即可自动上传,so easy.

写一个每天自动执行一次的 job 把所有数据 dump 出来,压缩一下,按日期命名,最后上传,一个简单的数据备份就做好了。

参考

https://www.dropbox.com/install-linux

相关文章

网友评论

      本文标题:Cookbook: 使用Dropbox做数据备份

      本文链接:https://www.haomeiwen.com/subject/vekkyftx.html