rsync
远程的同步工具,同步远程数据到另一台机器,可以保持原数据的属性(权限,所有者,timestap等等。
以server-client模式运行,rsync程序既可以做服务端,也可以做client的cmdline端。
服务模式运行在服务端:
rsync --daemon --config=/etc/rsyncd.conf
客户端在shell命令行下输入rysnc 命令来执行同步,在客户端和服务端进行同步数据。
在客户端运行:
rsync -aSvH --password-file=/etc/sery.pass root@remoteServer::data /home/
把远程的/etc/rsyncd.conf中的item【data】同步到本地的/home/下。
rysnc服务端配置:
[root@mailsvr ~] # cat /etc/rsyncd.conf
uid = root #root用户访问
gid = root #root组用户访问
use chroot = no #不能使用chroot
max connections = 9 #最大连接数
list = yes #允许列出文件清单
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = 192.168.1.2 #只允许这个主机访问
[data] #发布项
path = /home/data/ #发布的路径
ignore errors
read only = yes #只读
auth users = root #认证用户为root
secrets file = /etc/sery.pass #密码文件
mannual:
NAME
rsync — a fast, versatile, remote (and local) file-copying tool
SYNOPSIS
Local: rsync [OPTION...] SRC... [DEST]
Access via remote shell:
Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
Access via rsync daemon:
Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST
Usages with just one SRC arg and no DEST arg will list the source files
instead of copying.
DESCRIPTION
Rsync is a fast and extraordinarily versatile file copying tool. It
can copy locally, to/from another host over any remote shell, or
to/from a remote rsync daemon. It offers a large number of options
that control every aspect of its behavior and permit very flexible
specification of the set of files to be copied. It is famous for its
delta-transfer algorithm, which reduces the amount of data sent over
the network by sending only the differences between the source files
and the existing files in the destination. Rsync is widely used for
backups and mirroring and as an improved copy command for everyday use.
Rsync finds files that need to be transferred using a “quick check”
algorithm (by default) that looks for files that have changed in size
or in last-modified time. Any changes in the other preserved
attributes (as requested by options) are made on the destination file
directly when the quick check indicates that the file's data does not
need to be updated.
-------------------------------------------------------------------------------------------------------
cronolog
从stdin读取日志,根据日志的timestamp进行切割(切成文件),输出到适合的文件。
日志切割以模板为基准,如"%Y/%m/%d/access.log" 表示每天时间段的日志被放在这个位置。
通过选项 -d 制定切割周期,如每30minutes 切割一次。
mannual:
NAME
cronolog - write log messages to log files named according to a template
SYNOPSIS
cronolog [OPTION]... template
DESCRIPTION
cronolog is a simple program that reads log messages from its input and writes them to a set of output files, the names of which are constructed using template and
the current date and time. The template uses the same format specifiers as the Unix date(1) command (which are the same as the standard C strftime library function).
Before writing a message cronolog checks the time to see whether the current log file is still valid and if not it closes the current file, expands the template
using the current date and time to generate a new file name, opens the new file (creating missing directories on the path of the new log file as needed unless the
program is compiled with -DDONT_CREATE_SUBDIRS) and calculates the time at which the new file will become invalid.
cronolog is intended to be used in conjunction with a Web server, such as Apache to split the access log into daily or monthly logs. For example the Apache config‐
uration directives:
TransferLog "|/www/sbin/cronolog /www/logs/%Y/%m/%d/access.log"
ErrorLog "|/www/sbin/cronolog /www/logs/%Y/%m/%d/errors.log"
would instruct Apache to pipe its access and error log messages into separate copies of cronolog, which would create new log files each day in a directory hierarchy
structured by date, i.e. on 31 December 1996 messages would be written to
/www/logs/1996/12/31/access.log
/www/logs/1996/12/31/errors.log
after midnight the files
/www/logs/1997/01/01/access.log
/www/logs/1997/01/01/errors.log
would be used, with the directories 1997, 1997/01 and 1997/01/01 being created if they did not already exist. (Note that prior to version 1.2 Apache did not allow
a program to be specified as the argument of the ErrorLog directive.)
OPTIONS
-p PERIOD
--period=PERIOD
specifies the period explicitly as an optional digit string followed by one of units: seconds, minutes, hours, days, weeks or months. The count cannot be
greater than the number of units in the next larger unit, i.e. you cannot specify "120 minutes", and for seconds, minutes and hours the count must be a fac‐
tor of the next higher unit, i.e you can specify 1, 2, 3, 4, 5, 6, 10, 15, 20 or 30 minutes but not say 7 minutes.
分享到:
相关推荐
“First Sobell taught people how to use Linux . . . now he teaches you the power of Linux. A must-have book for anyone who wants to take Linux to the next level.” —Jon “maddog” Hall, Executive ...
What SSH is and how to use it, including creating and using SSH keys. The file system layout of Linux systems and where to find programs, configurations, and documentation. The basic Linux commands ...
These 24 engaging and information-rich half-hour lessons use one of the world’s most accessible, popular, and powerful computer languages, Python 3, as a gateway to the universe of programming....
Practical Guide to Linux Commands, Editors and Shell Programming (2013) “This book is a very useful tool for anyone who wants to ‘look under the hood’ so to speak, and really start putting the ...
Finally, the book walks you through processes and how these interact with your shell scripts, along with how to use scripts to automate tasks and how to embed other languages and execute them.
书名为《Linux Commands and Shell Programming 2nd》,即第二版《Linux命令及Shell编程实用指南》,作者为Mark G. Sobell。这本书被描述为Linux命令行操作和Shell编程的必备读物,其内容通俗易懂,翔实可靠,专注于...
Then, we will follow this by introducing Docker, how to install it, how to use its basic commands, and understand its workflow for build, ship, and run. Continuing further, we will then move to ...
标题中提到的"IPC MJPEG Stream via HTTP Commands"指的是如何通过HTTP命令获取网络摄像机(IPC, Internet Protocol Camera)的Motion JPEG(MJPEG)视频流。MJPEG是一种视频格式,它将每一帧单独编码为JPEG图像,...
Author Yevgeniy (Jim) Brikman introduces you to Terraform syntax, and shows you how to deploy and manage infrastructure with just a few CLI commands. You’ll also learn: Why every company needs to ...
77_linux_commands Commands and Utilities
They explain how to use these controls to create flexible and responsive layouts that adapt to different screen sizes and resolutions. #### User Interaction Controls (Chapter 7 & Appendix D) User ...
Through the course of the book, you’ll learn how to use OpenShift and the Wildfly application server to build and then immediately deploy a Java application online. Learn about OpenShift’s core ...
explains how to manage data through commands, and shares experiences from big players in the industry. What this book covers Chapter 1, Getting Started (The Baby Steps), shows you how to install Redis...
This book teaches you how to use commands to perform simple tasks all the way to scripting complex tasks such as managing large amounts of data on a network. It guides you on implementing some of ...
This book teaches you how to use commands to perform simple tasks all the way to scripting complex tasks such as managing large amounts of data on a network. It guides you on implementing some of ...
Next, it shows you how to use the peripheral libraries in sbt to make common tasks simpler. Finally, it covers how to deploy software effectively. You’ll learn to appreciate how sbt improves the ...
Finally, you will discover how you can work offline with Git, how to track what is going on behind the scenes, and how to use the stash for different purposes. What you will learn Understand the ...