最新消息:

利用脚本备份vps上网站数据的到dropbox网盘

Linux运维 大步 2642浏览 0评论

以前写了个《用城通网盘FTP备份vps上的网站数据》的教程,看到有人用dropbox备份网站数据,所以今天也试了一下,记得以前是一个python脚本,这是用的是bash 脚本,利用dropbox的api来上传下载的,很方便,脚本的地址是Dropbox-Uploader/dropbox_uploader.sh at master · andreafabrizi/Dropbox-Uploader · GitHub ,感谢作者分享这个脚本。

因为网速慢,也懒得截图,所以直接贴的文字,大家将就下吧。

第一步:下载dropbox_uploader.sh
可以到git下载,地址为:https://github.com/andreafabrizi/Dropbox-Uploader
或者也可以直接拷贝代码,保存为dropbox_uploader.sh,注意拷贝的时候最好是复制到文本编辑器里面,如notepad++之类的

 

 

额,文章貌似丢失了部分,图片虽然还在,但是懒得再写了,直接贴出官方的步骤吧。

第一次使用,这个脚本会给你指导,告诉你去哪里获得dropbox的 API key 。

因为只有配置好了 API key ,这样才能授权给脚本应用进入你的dropbox目录

Then give the execution permission to the script and run it:

$chmod +x dropbox_uploader.sh
$./dropbox_uploader.sh

 

The first time you run dropbox_uploader, you'll be guided through a wizard in order to configure access to your Dropbox. This configuration will be stored in ~/.dropbox_uploader.

Configuration wizard

The configuration wizard is pretty self-explanatory. One thing to notice is that if you choose "App permission", your uploads will end up on Dropbox under an App/<your_app_name> folder. To have them stored in another folder, such as in /dir/, you'll need to give Dropbox-Uploader permission to all Dropbox files.

Usage

The syntax is quite simple:

./dropbox_uploader.sh COMMAND [PARAMETERS]...

[%%]: Optional param
<%%>: Required param

Available commands:

  • upload <LOCAL_FILE/DIR ...> <REMOTE_FILE/DIR>
    Upload a local file or directory to a remote Dropbox folder.
    If the file is bigger than 150Mb the file is uploaded using small chunks (default 4Mb); in this case a . (dot) is printed for every chunk successfully uploaded and a * (star) if an error occurs (the upload is retried for a maximum of three times). Only if the file is smaller than 150Mb, the standard upload API is used, and if the -p option is used the default curl progress bar is displayed during the upload process.
    The local file/dir parameter supports wildcards expansion.
  • download <REMOTE_FILE/DIR> [LOCAL_FILE/DIR]
    Download file or directory from Dropbox to a local folder
  • delete <REMOTE_FILE/DIR>
    Remove a remote file or directory from Dropbox
  • move <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
    Move or rename a remote file or directory
  • copy <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
    Copy a remote file or directory
  • mkdir <REMOTE_DIR>
    Create a remote directory on DropBox
  • list [REMOTE_DIR]
    List the contents of the remote Dropbox folder
  • share <REMOTE_FILE>
    Get a public share link for the specified file or directory
  • info
    Print some info about your Dropbox account
  • unlink
    Unlink the script from your Dropbox account

Optional parameters:

  • -f <FILENAME>
    Load the configuration file from a specific file
  • -s
    Skip already existing files when download/upload. Default: Overwrite
  • -d
    Enable DEBUG mode
  • -q
    Quiet mode. Don't show progress meter or messages
  • -p
    Show cURL progress meter
  • -k
    Doesn't check for SSL certificates (insecure)

Examples:
./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old
./dropbox_uploader.sh upload *.zip /
./dropbox_uploader.sh download /backup.zip
./dropbox_uploader.sh delete /backup.zip
./dropbox_uploader.sh mkdir /myDir/
./dropbox_uploader.sh upload "My File.txt" "My File 2.txt"
./dropbox_uploader.sh share "My File.txt"
./dropbox_uploader.sh list

转载请注明:大步's Blog » 利用脚本备份vps上网站数据的到dropbox网盘

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (13)

  1. Wordpress也有個外掛(插件)直接備份到Dropbox的,還挺好用的 :razz: WordPress Backup to Dropbox
    超級efly4年前 (2013-08-25)Reply
    • 有时间去看看,难道是php调用api?能备份整个网站数据还是只能备份数据库?
      大步4年前 (2013-08-25)Reply
      • 是備份整個網站
        超級efly4年前 (2013-08-25)Reply
        • 那就太好了,就不要ssh,就可以在虚拟主机上备份了。
          大步4年前 (2013-08-25)Reply
  2. 关于all.www.tar.gz的话,是需要自已在ssh的时候压缩么? 譬如说,我的网站目录是/home/wwwroot,然后是需要包wwwroot文件夹压缩后mv到/home目录之下么?
    袅残烟3年前 (2013-12-30)Reply
    • 是的,你要先压缩,然后在上传,但是不一定要mv移动到home目录下,你可以使用绝度路径上传。比如:你打包后的all.tar.gz的绝对路径为/wwwroot/wiki/all.tar.gz。那么,你可以使用:/dropbox_uploader.sh upload /wwwroot/wiki/all.tar.gz 2013.tar
      大步3年前 (2013-12-30)Reply
  3. 我用的./dropbox_uploader.sh upload all.tar 2013.tar 结果> Uploading "/home/all.tar" to "/2013.tar"... DONE 完成了
    袅残烟3年前 (2013-12-30)Reply
    • 那就好,其实很容易使用的
      大步3年前 (2013-12-30)Reply
  4. 不才,刚写了个快盘版的,如果VPS在国内,速度飞快,国外VPS速度凑合。 http://wangheng.org/kuaipan-uploader.html
    王恒2年前 (2015-05-16)Reply
    • 不错,又多了个选择。
      大步2年前 (2015-05-17)Reply
  5. 爱奇趣网http://www.iqiqu.net/? 路过留个言!
    爱奇趣分享网2年前 (2015-08-21)Reply
SiteMap