Linux下的远程备份(镜像)工具rsync

0 简介传统上,在Unix系统下使用的备份工具主要有tardumprdump)、restorerrestore)、ddcpiorcp等工具。这些工具中大多数适合于本地备份(native backup),倘若要执行远程备份(remote backup)的话,往往显得力不从心。在Linux系统下提供了一个工具——rsync,据其文档说明,它是rcp工具的一个替代品,但是更快捷、更灵活。rsync采用的remote-update协议允许rsync通过网络链路传输两组文件的增量,而是不是文件本身,据此rsync可以提高传输效率。rsync所具有的功能特色主要有:l 支持对连接、设备、用户、组、权限的拷贝;l 支持类似GNU tar工具的excludeexclude-from选项;l 类似CVSexclude模式:忽略相同的文件;l 可以使用多种远程shell工具,比如rsh或者sshl 不需要root权限即可运行;l 将文件传输流水线化以减少延迟开销;l rsync服务器允许以匿名或者认证方式登录(特别适合于做镜像)。和大多数网络工具一样,rsync也是以服务器/客户端的方式工作的。但较为特别的一点是:rsync服务器和客户端都使用同一个程序——rsync(如果按常见的做法,则应该是服务器程序为rsyncd,客户端程序为rsync)。启动服务器的时候需要指明–daemon选项,以表明启动的是服务器。而在启动客户端程序的时候则不应开启–daemon选项。在下文中,假设需要备份的主机为192.168.0.100,其上运行rsync服务器,将该主机称之为rsync-server;存放备份数据的主机为192.168.0.200,其上运行rsync客户端程序,将该主机称之为rsync-client阅读全文

Keyconfig for Firefox 3

I’ve been happily using Firefox 3 for the past couple months. On the Mac in particular, it’s been a night and day difference performance-wise. One of the more unfortunate aspects right now is that there aren’t a lot of extensions that work with FF3 at the moment. One of those that I missed a lot was the keyconfig extension.

It hasn’t been updated for a while (and the download site is a bit on the sparse side, but it looks like the author, dorando is still active and there are directions for modifying the XPI to be compatible w/ FF3.

Since I went through the trouble of modifying the bits, I thought I’d throw it up there for those less inclined to muck around in the files. This will give an unsigned warning, but should install: keyconfig-ff3.xpi.

Modifications:

  • install.rdf modified with <maxVersion>3.0.*</maxVersion>
  • install.rdf modified to comment out <updateURL> so it can be installed w/o modifying security preferences
  • this.os.addObserver(this,"stupid-dummy",false); added to function keyconfigService()
  • document.createElement("key") changed to gDocument.createElement("key") in the keyconfig.jar!contents/keyconfig.js file

Firefox 页面滚动设置

打开firefox,在地址栏输入about:config

1.开启页面平滑滚动
general.smoothScroll
布尔值
当值为Ture时,打开页面平滑滚动

2.增加鼠标页面卷动行数
mousewheel.withnokey.sysnumlines
布尔值
先设置值为False时,禁用页面滚动行数为操作系统设置值

mousewheel.withnokey.numlines 设定了滚动的行数,推荐设置为7。
整数型
设置适当的整数值为滚动行数,推荐值7,

把“我的电脑”捧上去放在桌面第一

是否希望把桌面上“我的电脑”捧回到第一个位置呢?

打开“注册表编辑器”,找到[HKEY_CLASSES_ROOTCLSID{450D8FBA- AD25-11D0-98A8-0800361B1103],在右侧窗格找到名为SortOrderIndex的DWORD键值,设置这个键值,就可以轻 松控制“我的电脑”与“我的文档”的上下关系。在十六进制下更改为48,则是“我的电脑”图标位于“我的文档”之下,原先的54值则反之。另外,此操作也 影响到地址栏下拉列表、打开窗口的“查找范围”下拉列表的排列。

SHELL下date命令的用法

date命令如何获得上星期的日期?

#date -d “-1 week” “+%Y%m%d %A”

举一反三:date命令获得前天,昨天,明天,后天,上个月,下个月的日期

date -d “-2 day” “+%Y%m%d %A” 或 date –date=”2 days ago” “+%Y%m%d %A”

date -d “-1 day” “+%Y%m%d %A” 或 date –date=”1 day ago” “+%Y%m%d %A”

date -d “1 day” “+%Y%m%d %A”

date -d “2 day” “+%Y%m%d %A”

date -d “-1 month” “+%Y%m%d %A”

date -d “1 month” “+%Y%m%d %A”
阅读全文

Thunderbird 邮件导入导出的方法

Thunderbird 邮件的导入导出是困惑已久的问题,尝试用这样的方法操作:
(1)安装 Thunderbird AutoSave 扩展。
(2) 重启 Thunderbird 后,选中你要导出的邮件,可以用“Ctrl + 左键”多选,也可以“Ctrl + A” 全选,然后点右键或从“文件”菜单中选择 Export Selected Msgs—>Individually ,导出到你指定的文件夹,格式为 .eml 文件。
(3)选中这些 .eml 文件,拖入到 OE 中。

对于将邮件从 OE 导入到 Thunderbird,可以用“工具—>导入”
对于将邮件从 foxmail 导入到 Thunderbird ,在安装 Thunderbird AutoSave 扩展后,可以先在 foxmail 中将邮件保存为 .eml 文件,然后打开 Thunderbird,选择“文件—>Import Messages“,选中要导入的邮件,打开即可。

Tb AutoSave Extension 扩展中文版下载: http://addons.mozine.cn/firefox/465/

另外一个办法是安装 ImportExportTools 扩展,该扩展能够将 eml/mbox 格式的邮件文件导入 Thunderbird,也可以将 Thunderbird 中的邮件导出为 eml/mbox/html 或者纯文本格式。支持批量操作:
http://addons.mozine.cn/thunderbird/98

关于Firefox与Thunderbird便携版、绿色版制作完全攻略

经常看到大家在论坛中讨论如何制作或使用绿色或便携的Firefox和Thunderbird问题,我也是非常喜欢使用绿色软件,同时,我也很高兴在这里与大家分享一些我的心得与体会:
制作绿色、移动的Mozilla软件

以下是Firefox、Thunderbird为例,其他的NVU等等类似软件,可以参考。
1、绿色安装版制作
目的:让Firefox或Thunderbird作为本机的缺省浏览器或邮件客户端。
对策:这种目的免不了要修改注册表,因此,如果配置文件不想放到系统缺省个人文件夹中的话,有两种办法:
1)将系统个人文件夹指向改到新的盘符路径下(因影响较大,现不推荐,因此不详说)
2)获得安装时对注册表的修改,将Firefox或Thunderbird的启动路径中都增加上“-profile X:…YYY”的配置路径指向

评估:这种方法耗时费力,还要准备专门的恢复脚本,比较麻烦,因此不推荐一般用户使用。
备注:我曾经有段时用过此方法,主要是研究软件对注册表与系统的写入信息,所以,本方法纯属个人研究玩玩。
阅读全文

如何使执行scp命令时不需要输入用户密码

首先制作密码匙∶
ssh-keygen -t rsa 按三次 Return 键
scp ~/.ssh/ida_dsa.pub username@somewhere.com:~/.ssh/authorized_keys2

$ssh-keygen -t rsa
$Generating public/private rsa key pair.
$Enter file in which to save the key (/root/.ssh/id_rsa): ←直接回车
$Enter passphrase (empty for no passphrase): ←直接回车
$Enter same passphrase again: ←直接回车
$Your identification has been saved in /root/.ssh/id_rsa.
$Your public key has been saved in /root/.ssh/id_rsa.pub.
$The key fingerprint is:
$49:9c:8a:8f:bc:19:5e:8c:c0:10:d3:15:60:a3:32:1c root@Client

阅读全文

zlib安装

在编译软件./configure时得到错误反馈
checking zlib.h usability… no
checking zlib.h presence… no
checking for zlib.h… no

zlib软件包所包含的库经常被一些软件的压缩或解压缩函数用到,所以如果编译软件时需要Zlib则说明这个软件正好含有压缩或解压缩函数,我们需要安装zlib软件包。

先到zlib官方网站:http://www.zlib.net 上下载源码来安装zlib软件包。

目前最新版本zlib是zlib1.2.3,安装开始;
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar -xvzf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
sudo make install

这就完成了zlib1.2.3的安装,由于安装zlib1.2.3需要编译,所以最基本的编译器是要安装好的。

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

使用SSH登录另外一台机器,
#ssh 192.168.1.105

得到如下输出
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a5:1c:99:1f:fa:d7:1e:76:8b:0a:67:eb:4f:90:24:7a.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for 192.168.1.105 has changed and you have requested strict checking.
Host key verification failed.

搜索得到如下解决:
阅读全文