文件自动备份和同步bypy和syncthing
http://blog.csdn.net/pipisorry/article/details/52464402
Linux定时备份数据到百度云盘
sudo pip3 install requests
sudo pip3 install bypy
备份脚本示例
#!/bin/sh
# File: ~/bysync.sh
# Author: pipi
# Email: pipisorry@126.com
echo -e "\033[33;1m ***********自定义DIRS=~/SysReinstall ~/files/DESKTOP********* \033[0m"
DIRS=$(echo '~/SysReinstall ~/files/DESKTOP')
echo -e "\033[33;1m ************************************ \033[0m"
echo -e "\033[33;1m ************百度云盘自动同步************ \033[0m"
DATE=`date +%F`
DATE_YEAR=`date +%Y`
DATE_MONTH=`date +%m`
for DIR in $DIRS
do
echo -e "\033[33;1m *****上传$(basename $DIR)****** \033[0m"
bypy mkdir $DATE_YEAR/$DATE_MONTH/$(basename $DIR)
bypy -v syncup $DIR/* $DATE_YEAR/$DATE_MONTH/$(basename $DIR)
# bypy -v syncup $DIR/* $DATE_YEAR/$DATE_MONTH/$(basename $DIR)
done
bypy list
echo -e "\033[33;1m **********百度云盘自动同步完成********** \033[0m"
echo -e "\033[33;1m ************************************ \033[0m"
Note: 现在不能直接备份文件夹了,只能压缩了再上传!!!坑B的百度网盘,要准备换个网盘了!!!
可能出现的问题
1 第一次运行要授权,打开命令行中的提示网站,复制授权码到命令行中
2 可能会由于百度权限问题,使用百度云备份需要差不多一个月跟新一次授权,否则报错
OpenShift server failed, authorizing/refreshing with the Heroku server …
或者不小心删除了Hash Cache File '/home/pipi/.bypy/bypy.hashcache.json' not found, no caching
Note: Skip saving Hash Cache since it has not been updated.这个应该不是错误,而是没有再次更新授权的提示吧。
更新(重新)授权办法如下:
运行bypy.py -c,删除令牌文件,然后重新授权一次。如果还不行,去百度应用授权里删除bypy再重新授权。
linux、windows文件自动同步syncthing
syncthing安装
linux下安装
两台电脑上都要安装
#https://github.com/syncthing/syncthing/releases echo -e "\033[31;1m SYNC_URL=https://github.com/syncthing/syncthing/releases/download/v0.14.6/syncthing-linux-amd64-v0.14.6.tar.gz \033[0m" SYNC_URL=https://github.com/syncthing/syncthing/releases/download/v0.14.6/syncthing-linux-amd64-v0.14.6.tar.gz echo -e "\033[31;1m *************手动配置************* \033[0m" echo -e "\033[31;1m *********************************** \033[0m" echo -e "\033[31;1m *********************************** \033[0m" echo -e "\033[31;1m *************syncthing************* \033[0m" echo -e "\033[31;1m test -d ~/opt || mkdir -p ~/opt \033[0m" echo -e "\033[31;1m Add the release PGP keys: \033[0m" curl -s https://syncthing.net/release-key.txt | sudo apt-key add - echo -e "\033[31;1m Add the release channel to your APT sources: \033[0m" echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list echo -e "\033[31;1m Update and install syncthing \033[0m" sudo apt-get update sudo apt-get install -y syncthing echo -e "\033[31;1m syncthing & \033[0m" syncthing & #http://localhost:8080
最后会自动从默认浏览器中打开syncthing管理界面。
安装方式2
#https://github.com/syncthing/syncthing/releases
echo -e "\033[31;1m SYNC_URL=https://github.com/syncthing/syncthing/releases/download/v0.14.6/syncthing-linux-amd64-v0.14.6.tar.gz \033[0m"
SYNC_URL=https://github.com/syncthing/syncthing/releases/download/v0.14.6/syncthing-linux-amd64-v0.14.6.tar.gz
echo -e "\033[31;1m *************手动配置************* \033[0m"
echo -e "\033[31;1m *********************************** \033[0m"
echo -e "\033[31;1m *********************************** \033[0m"
echo -e "\033[31;1m *************syncthing************* \033[0m"
echo -e "\033[31;1m test -d ~/opt || mkdir -p ~/opt \033[0m"
test -d ~/opt || mkdir -p ~/opt
cd ~/opt
#wget $SYNC_URL
echo -e "\033[31;1m tar xzf syncthing-linux-amd64-*.tar.gz \033[0m"
tar xzf syncthing-linux-amd64-*.tar.gz
cd syncthing-linux-amd64-*/
echo -e "\033[31;1m sudo cp syncthing /usr/local/bin/ \033[0m"
sudo cp syncthing /usr/local/bin/
echo -e "\033[31;1m sed -i 's/127.0.0.1:8080/0.0.0.0:8080/g' ~/.config/syncthing/config.xml \033[0m"
sed -i 's/127.0.0.1:8080/0.0.0.0:8080/g' ~/.config/syncthing/config.xml
echo -e "\033[31;1m syncthing \033[0m"
syncthing
#http://localhost:8080
syncthing管理界面配置
管理界面地址:http://localhost:8080
设置访问网页管理界面的管理员用户和密码:点击右上角的齿轮按钮,然后选择Settings。(局域网上的同步不需要设置)
连接到其它服务器:添加同步的设备
要在各个系统之间同步文件,你必须各自告诉它们其它服务器的信息。这是通过交换设备IDs(device IDs)来实现的。
选择“齿轮菜单(gear menu)”(在右上角)中的”Show ID(显示ID)“来找到它。
只要选择其中一个电脑,添加另一个电脑的id就可以了,另一个电脑上就会有提示进行相互添加。
在Device区域粘贴另一系统 ID **。输入设备名称(可选)。在地址区域,你可以输入其它系统的IP地址,或者使用默认值dynamic。
另一系统就会收到添加id的信息进行双向确认就可以了。
这个软件只要添加了设备id就可以自动查找另一配对设备的ip地址并添加(局域网和广域网都自动添加)。
选择要同步的文件夹
在系统上设置要同步的文件路径
同样,另一个系统会收到一个确认。这时另一个系统就可以指定一个与其对应的文件夹来进行同步。
广域网同步
上面的同步是在同一个局域网中进行的,如果想在广域网上进行同步,可以在setting中设置监听地址为0.0.0.0。两台电脑都要如此设置。
过一段比较长的时间会就可以连接上了,在广域网上进行同步了。
连接上后自动同步的情况
名词解释
- Unknown
- while the GUI is loading.
- Unshared
- when you have not shared this folder,
- Stopped
- when the folder has experienced an error,
- Scanning
- while Syncthing is looking in the folder for local changes,
- Up to Date
- when the folder is in sync with the rest of the cluster,
- Syncing
- when this device is downloading changes from the network.
Among the folder details, you can see the current “Global State” and “Local State” summaries, as well as the amount of “Out of Sync” data if the the folder state is not up to date.
- Global State
- indicates how much data the fully up to date folder contains - this is basically the sum of the newest versions of all files from all connected devices. This is the size of the folder on your computer when it is fully in sync with the cluster.
- Local State
- shows how much data the folder actually contains right now. This can be more or less than the global state, if the folder is currently synchronizing with other devices.
- Out of Sync
- shows how much data needs to be synchronized from other devices. Note that this is the sum of all out of sync files - if you already have parts of such a file, or an older version of the file, less data than this will need to be transferred over the network.
[Syncthing: 一个在计算机之间同步文件/文件夹的私密安全同步工具]
from: http://blog.csdn.net/pipisorry/article/details/52464402
ref:
文件自动备份和同步bypy和syncthing的更多相关文章
- RMAN兼容性、控制文件自动备份、保存时间、备份策略、备份脚本(二)
RMAN 程序的兼容性 RMAN 环境由以下5部分组成:(1) RMAN executable(2) Recovery catalog database(3) Recovery catalog sch ...
- 如何将云上的Linux文件自动备份到本地服务器
需求场景: 将云上一台Linux服务器文件备份到本地服务器,一周一备即可. 面对这样一个需求,我们可能面临下列几个问题, 备份方式:是云服务器推文件到本地服务器写入,还是本地服务器从云服务器拉文件?这 ...
- 为什么 RMAN 控制文件自动备份的名称格式没有遵循 %F 规则
在 Oracle 中越是简单的问题,往往越难找到答案,举个例子: 你是否留意观察过在 RMAN 进行备份的时候,自动生成的控制文件名称是否是按照 %F 规则来生成的? 关于控制文件自动备份路径格式,在 ...
- 关于 RMAN 控制文件自动备份路径中指定的 %F 说明
默认情况下,RMAN备份的属性配置一共 14 行( show all; )来自博客园AskScuti CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVIC ...
- linux 中部署 rsync 实现文件远程备份及 同步
客户端:数据源:服务端:数据接收方 rsync官方文档:https://www.samba.org/ftp/rsync/rsync.html 手动测试用“通过远程外壳访问"里的语法: 参考1 ...
- UltraEdit UE如何取消保存文件自动备份
高级-配置-文件处理-备份,设置为不备份
- 打造百度网盘备份利器:自动备份Linux VPS文件和多线程下载百度网盘资源
前一段时间国内的各大网盘百度云盘,金山快盘,360云盘,华为网盘为争夺用户上演空间容量博弈,网盘商们还固执地以为中国的网民都不懂网络技术,可以像某公司那样用一些数字的手段来忽悠用户,参与到网盘商的数字 ...
- 【RMAN】Oracle中如何备份控制文件?备份控制文件的方式有哪几种?
真题1. 如何备份控制文件?备份控制文件的方式有哪几种? 答案:备份控制文件的方式有多种. ① 备份控制文件可以在线进行: SQL> ALTER DATABASE BACKUP CONTROLF ...
- Linux下使用SSH、Crontab、Rsync三工具实现数据自动备份
Linux下使用SSH.Crontab.Rsync三工具实现数据自动备份 作为网管人员大概都无一例外的经历过系统备份,尤其是重要系统的备份.重要数据库系统的备份工作.由于备份是个频繁而琐碎的工作,如何 ...
随机推荐
- hosts管理工具1.0发布了。。。。
hosts管理工具1.0发布了.... 可以快速管理hosts文件了,再也不用打开系统盘,一个目录一个目录的查找了. 快速方便的修改host文件,一键保存. 可快速注释当前行,或者取消注释当前行,只需 ...
- Centos6.9连接工具设置
由于vm下面的centos6.9这种操作环境非常的不友好,用起来非常的不方便, 所以我们需要用一个远程连接工具来连接,我们的虚拟机.我们使用的是teraterm. 下载地址:https://osdn. ...
- Linux(四)使用Xshell5远程登录
Xshell5和Xftp5的安装包 链接:https://pan.baidu.com/s/1q3-ch75TW3lvC3KX25klNQ 密码:m31n 说明: 公司开发的时候,具体情况是这样的: 1 ...
- [HNOI2001]求正整数
题目描述 对于任意输入的正整数n,请编程求出具有n个不同因子的最小正整数m. 例如:n=4,则m=6,因为6有4个不同整数因子1,2,3,6:而且是最小的有4个因子的整数. 输入输出格式 输入格式: ...
- LOJ #6041. 事情的相似度
Description 人的一生不仅要靠自我奋斗,还要考虑到历史的行程. 历史的行程可以抽象成一个 01 串,作为一个年纪比较大的人,你希望从历史的行程中获得一些姿势. 你发现在历史的不同时刻,不断的 ...
- Orz
OR: 说实话,感觉Virtual Judge挺好使的,至少到现在,Uva都没注册成功过QAQ,估计是校园网的问题 不得不说现在课越来越多,而且对于我们这种学校ACM才开展两年的来说,时间真的好有限, ...
- FJOI2017 RP++
嗯如果算得没错大概十二小时之后就是省选二试了 这次考试貌似就在我们学校 虽然机子挺旧的基本没用过 平时训练都是在专门的机房 其实貌似压力不是很大 因为一试跪了TAT 那时候还是图样 T3按照惯例是 ...
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
1. Background Though it's always difficult to give child a perfect name, parent never give up trying ...
- Linux常用命令大全(归类)
最近都在和Linux打交道,这方面基础比较薄弱的我只好买了本鸟哥的书看看,感觉还不错.我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因, ...
- Linux学习之Centos(三)------系统文件目录及含义详解
Linux学习之Centos 之三------文件目录及含义 在了解了每个文件的相关种类与属性,以及了解了如何更改文件属性/权限的相关信息后,再来要了解的就是, 为什么每套Linux distribu ...