10.32/10.33 rsync通过服务同步 10.34 linux系统日志 screen工具
通過后臺服務的方式
在遠程主機上建立一個rsync的服務器,在服務器上配置好rsync的各種應用,然后將本機作為rsync的一個客戶端連接遠程的rsync服務器。
在128主機上建立并配置rsync的配置文件/etc/rsyncd.conf,把你的rsyncd.conf編輯成以下內容:
[root@aminglinux-123?~]#?vim?/etc/rsyncd.conf #?/etc/rsyncd:?configuration?file?for?rsync?daemon?mode port=873 log?file=/var/log/rsync.log pid?file=/var/run/rsyncd.pid address=192.168.193.128 #?See?rsyncd.conf?man?page?for?more?options.#?configuration?example: [test] path=/root/rsync read?only=no list=true uid?=?root gid?=?root use?chroot=true max?connections=4 auth?users=test secrets?file=/etc/rsyncd.passwd hosts?allow=192.168.193.128rscond.com中的port,logfile,pid file,address都屬于全局配置;[test]以下的部分就是模塊配置。man rsyncd.conf可以獲得更多信息。
port:指定在哪個端口啟動rsyncd服務,默認是873端口。
log file:指定日志文件。
pid file:指定pid文件,這個文件的作用涉及服務的啟動、停止等進程管理操作。
address:指定啟動rsyncd服務的IP。
[]:指定模塊名。
path:指定數據存放的路徑。
use chroot true|false:表示在傳輸文件之前,首先chroot到path參數所指定的目錄下。
max connections:指定最大的連接數,默認是0,即沒有限制。
read only ture|false:如果為true,則不能上傳到該模塊指定的路徑下。
list:表示當用戶查詢該服務器上的可用模塊時,該模塊是否被列出,設定為true則列出,設定為false則隱藏。
uid/gid:指定傳輸文件時以哪個用戶/組的身份傳輸。
auth users:指定傳輸時要使用的用戶名。
secrets file:指定密碼文件。
hosts allow:表示被允許連接該模塊的主機。
編輯secrets file并保存后要賦予600權限。
[root@aminglinux-123?etc]#?cat?/etc/rsyncd.passwd [root@aminglinux-123?etc]#?vim?/etc/rsyncd.passwd [root@aminglinux-123?etc]#?cat?/etc/rsyncd.passwd test:test123 [root@aminglinux-123?etc]#?chmod?600?/etc/reyncd.passwd chmod:?無法訪問"/etc/reyncd.passwd":?沒有那個文件或目錄 [root@aminglinux-123?etc]#?chmod?600?/etc/rsyncd.passwdlinux系統日志
/var/log/messages
體統啟動時的引導信息,系統運行時的其他狀態都會存放在這個文件里。
通過logrotate工具來實現的,它的配置文件是/etc/logrotate.conf。
[root@aminglinux-123?~]#?cat?/etc/logrotate.conf #?see?"man?logrotate"?for?details #?rotate?log?files?weekly weekly#?keep?4?weeks?worth?of?backlogs rotate?4#?create?new?(empty)?log?files?after?rotating?old?ones create#?use?date?as?a?suffix?of?the?rotated?file dateext#?uncomment?this?if?you?want?your?log?files?compressed #compress#?RPM?packages?drop?log?rotation?information?into?this?directory include?/etc/logrotate.d#?no?packages?own?wtmp?and?btmp?--?we'll?rotate?them?here /var/log/wtmp?{monthlycreate?0664?root?utmpminsize?1Mrotate?1 }/var/log/btmp?{missingokmonthlycreate?0600?root?utmprotate?1 }#?system-specific?logs?may?be?also?be?configured?here.man rsyslog.com 查看更多信息。
dmesg
可以顯示系統的啟動信息
安全日志
xargs應用
查找當前目錄創建時間大于10天的文件,然后再刪除。
screen工具介紹
使用nohup
先寫一個sleep.sh腳本,放到后臺執行。
[root@aminglinux-123?test]#?cat?/usr/local/sbin/sleep.sh !?/bin/bash [root@aminglinux-123?test]#?nohup?sh?/usr/local/sbin/sleep.sh?& [1]?40760screen工具
screen是一個可以在多個進程之間多路復用一個物理終端的窗口管理器。
安裝screen命令yum install -y screen
-bash-4.2#?screen?-ls There?is?a?screen?on:40865.pts-1.aminglinux-123??????(Detached) 1?Socket?in?/var/run/screen/S-root.轉載于:https://blog.51cto.com/13107353/2147500
總結
以上是生活随笔為你收集整理的10.32/10.33 rsync通过服务同步 10.34 linux系统日志 screen工具的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到雨天开车路况难是什么意思
- 下一篇: Linux 下的 hosts文件