rsync 日志时间与系统时区不一致的问题
作者:互联网
需要设置一个软连接 /etc/localtime
通过测试发现 rsync默认读取的是 /etc/localtime这个下面的某一个时区,如果没有设置软连接,就算系统时间和现实时间一致,rsync的日志时间也会慢8个小时
# 系统时间与实际时间一致
# date
Wed Jun 8 18:03:31 CST 2022
# ls /etc/localtime
Africa Atlantic Canada EST5EDT GB GMT0 Indian Kwajalein Mexico PST8PDT ROK UTC iso3166.tab tzdata.zi
America Australia Chile Egypt GB-Eire Greenwich Iran Libya NZ Pacific Singapore Universal leapseconds zone.tab
Antarctica Brazil Cuba Eire GMT HST Israel MET NZ-CHAT Poland Turkey W-SU posix zone1970.tab
Arctic CET EET Etc GMT+0 Hongkong Jamaica MST Navajo Portugal UCT WET posixrules
Asia CST6CDT EST Europe GMT-0 Iceland Japan MST7MDT PRC ROC US Zulu right
# 谨慎使用,删除目录前最好备份。
sh-4.2# rm -fr /etc/localtime
# 设置软连接并检测没有问题
sh-4.2# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sh-4.2# ls -l /etc/localtime
lrwxrwxrwx 1 root root 33 Jun 8 18:47 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai
# 接下来就是看rsync打印的日志了
sh-4.2# tail -f /letv/logs/rsync_cmsmessage.log
2022/06/08 10:47:01 [5186] sent 46 bytes received 28,975 bytes 58,042.00 bytes/sec
2022/06/08 10:47:01 [5186] total size is 179,792,075 speedup is 6,195.24
2022/06/08 18:48:01 [5196] receiving file list
2022/06/08 18:48:01 [5197] sent 46 bytes received 28,975 bytes 58,042.00 bytes/sec
2022/06/08 18:48:01 [5197] total size is 179,792,075 speedup is 6,195.24
可以看到 时间自动更新完成。
标签:rsync,08,bytes,etc,2022,时区,日志,localtime 来源: https://www.cnblogs.com/gengmengong/p/16356811.html