LINUX 524 rsync+inotify 调试(问题1:指定端口无法同步/已通过;问题2:rsync.log文件中时间不显示/已显示)
怎么把java文件夹给传过去了
rsync +inotify 监控代码实时传输调试
没看到日志
这里面有了
rsync -e"ssh -p 3712" -av /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/
文件夹后面的/要加上
[root@localhost java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
echo “ ( d a t e + ′ (date + '%F %T') fasheng (date+′events” >>/var/log/rsync.log 2>&1 [root@localhost java]# cat /var/log/rsync.log
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
‘date+%F\ %T’ fasheng/root/app/java/ CREATE 321.java
‘date+%F\ %T’ fasheng/root/app/java/ MODIFY 321.java
‘date+%F\ %T’ fasheng/root/app/java/ CREATE 21.java
‘date+%F\ %T’ fasheng/root/app/java/ ATTRIB 21.java
‘date+%F\ %T’ fasheng/root/app/java/ CREATE 34.txt
‘date+%F\ %T’ fasheng/root/app/java/ ATTRIB 34.txt
‘date+%F\ %T’ fasheng/root/app/java/ CREATE 322.java
‘date+%F\ %T’ fasheng/root/app/java/ MODIFY 322.java
‘date+%F\ %T’ fasheng/root/app/java/ CREATE 333.java
‘date+%F\ %T’ fasheng/root/app/java/ MODIFY 333.java
问题:为什么倒数几行不显示传输的具体时间 我配置了inotify.sh:主要作用是当监控到源文件夹中文件变化时,将源文件夹中文件同步到目标主机目标文件夹,并使用echo " ( d a t e + ′ (date + '%F %T')" fasheng (date+′events >>/var/log/rsync.log 2>&1
两个问题:1.修改shell后是否需要重新nohup ./.sh & 看日志没有同步记录 2.rsync --delete 同步是以源文件夹为准 进行删除吗?
参考
2.是
1.计划试一下
没有变化
看上去是同步了 但是日志里没有记录
没监控到?
确实把目标主机的删了 和源主机的同步了
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done
为什么192.168.235.100:/home/code/backup/java_backup 出现新文件时,/root/app/java没有同步删除 /home/code/backup/java_backup中的文件,日志中没有监控记录
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
没看到变化
为啥没同步过去
要有免密登录才能实时传吗
免密登录
手动能传过去
为什么不能监控备份呢
计划删掉输出到日志文件看下
不能监控备份 是因为inotifywait 失效吗
[caozx26@code java]$ cd /home/caozx26
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$
#code是什么意思
code是什么意思,我现在不在code目录下 @前后表达的含义
确实 我的inotify.sh在/usr/local/bin/目录下,在其他目录直接执行nohup ./inotify.sh &能顺利运行该进程吗?&是什么意思
根据你的问题,以下是详细解答:
一、能否在其他目录直接运行 nohup ./inotify.sh &? 答案:不能直接运行。原因如下:
路径问题:./inotify.sh 表示执行当前目录下的 inotify.sh 脚本。如果你的脚本实际位于
/usr/local/bin/ 目录,且当前工作目录不在 /usr/local/bin,则系统会提示找不到文件。 正确执行方式:
使用绝对路径:nohup /usr/local/bin/inotify.sh &。 利用 PATH 环境变量:若
/usr/local/bin 已加入系统 PATH,可直接通过脚本名执行:nohup inotify.sh &。 二、& 符号的作用 & 是
Linux 中用于将命令放入后台运行的符号,具体功能包括:后台执行:命令不会阻塞终端,用户可继续输入其他操作。 输出控制:
默认情况下,后台进程的输出会显示在终端(可能干扰当前操作)。 建议结合输出重定向(如 > output.log 2>&1)避免输出混乱。
进程管理: 通过 jobs 查看后台任务列表,fg %n 将任务带回前台,kill %n 终止任务。 若未使用
nohup,终端关闭后后台任务会被终止(因收到 SIGHUP 信号)。
若intofy.sh在/usr/local/bin目录下,进入/usr/local/bin,然后直接运行nohup ./inotify.sh & 可以吗?如果成功运行了,inotify.sh中的内容是否就可以一直执行了
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
不是已经指定了端口访问 为什么nohup.out 还是报错 port22
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -e"ssh -p 3712" -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done
[root@localhost bin]# rsync -e “ssh -p 3712” -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/
sending incremental file list
deleting 34.txt
./
sent 476 bytes received 39 bytes 1,030.00 bytes/sec
total size is 6,291,456 speedup is 12,216.42
单独执行rsync语句有用,为什么一放到inotify.sh脚本文件中就不执行。/var/log/rsync.log记录了删除记录。nohup.out中都是错误记录:ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
[root@localhost bin]#
[root@localhost bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
do
rsync -e “ssh -p 3712” -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/
echo “ ( d a t e + (date +%F\ %T) fasheng (date+events” >> /var/log/rsync.log 2>&1
done
改回来报错
b把默认端口改为22试试
ssh code@192.168.235.100
ssh: connect to host 192.168.235.100 port 22: Connection refused
a
[root@localhost bin]# vim /usr/local/bin/inotify.sh
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done [root@localhost bin]# cd /root/app/java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# ls
66.java 69.java aa3 file20.java file23.java file4.java file7.java
67.java aa1 file19.java file21.java file2.java file5.java
68.java aa2 file1.java file22.java file3.java file6.java
[root@localhost java]# rm -rf 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
[root@localhost java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# rm -rf 67.java
[root@localhost java]# ls
68.java aa2 file1.java file22.java file3.java file6.java
69.java aa3 file20.java file23.java file4.java file7.java
aa1 file19.java file21.java file2.java file5.java
[root@localhost java]#
b:
[root@localhost bin]# vim /usr/local/bin/inotify.sh
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done [root@localhost bin]# cd /root/app/java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# ls
66.java 69.java aa3 file20.java file23.java file4.java file7.java
67.java aa1 file19.java file21.java file2.java file5.java
68.java aa2 file1.java file22.java file3.java file6.java
[root@localhost java]# rm -rf 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
[root@localhost java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# rm -rf 67.java
[root@localhost java]# ls
68.java aa2 file1.java file22.java file3.java file6.java
69.java aa3 file20.java file23.java file4.java file7.java
aa1 file19.java file21.java file2.java file5.java
[root@localhost java]#
现在同步成功了
推测应该是port 的问题
a:
[root@localhost java]# cd /usr/local/bin
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ls
inotify.sh inotifywait inotifywatch nohup.out
[root@localhost bin]# cat nohup.out
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
./inotify.sh:行4: 未预期的符号 `(' 附近有语法错误
./inotify.sh:行4: ` rsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup'
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
sending incremental file list
deleting 66.java
deleting 35.txt
./sent 437 bytes received 50 bytes 324.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 67.java
./sent 418 bytes received 40 bytes 916.00 bytes/sec
total size is 0 speedup is 0.00
查看nohup可以看到成功同步了
推测之前的应该是端口无法在shell中识别
之前配置过
/usr/local/bin/inotifywait -mrq -e create,move,delete,attrib,modify /root/app/java |while read events
dorsync -e"ssh -p 3712" -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup
#echo"'date + %F\ %T' SHIJIAN$events">>/var/log/rsync.log 本句语法推测有点问题 rsync.log中时间不能显示 故注掉
done
还配置过
rsync -e"/usr/bin/ssh -p 3712" -av --delete / @ :
这种形式 也没同步成功
计划再尝试下吧 看看能不能同步成功
cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE aa4
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa4
'date+%F\ %T' fasheng/root/app/java/ CREATE aa5
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
[root@code java]# cat /usr/local/bin/inotfy.sh
cat: /usr/local/bin/inotfy.sh: 没有那个文件或目录
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "'date +%F\ %T' fasheng$events" >> /var/log/rsync.log 2>&1
done
为什么/var/log/rsync.log中没有呈现具体的时间,‘date+%F\ %T’ fasheng/root/app/java/ DELETE 68.java
之前改过
echo “ ( d a t e + (date +%F\ %T) fas (date+events”>>/var/log/rsync.log 2>&1这种形式,/var/log/rsync.log中也没有呈现具体的时间
[root@code java]# rm -rf 69.java
[root@code java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE aa4
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa4
'date+%F\ %T' fasheng/root/app/java/ CREATE aa5
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 69.java
[root@code java]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 35 4月 19 17:20 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done
修改了后还是/var/log/rsync.log中还是不输出时间
a:
[root@code java]# pkill -f inotify.sh
[root@code java]# /usr/local/bin/inotify/sh &
[1] 37918
[root@code java]# bash: /usr/local/bin/inotify/sh: 没有那个文件或目录
^C
[1]+ 退出 127 /usr/local/bin/inotify/sh
[root@code java]# /usr/local/inotify.sh &
[1] 37968
[root@code java]# bash: /usr/local/inotify.sh: 没有那个文件或目录
^C
[1]+ 退出 127 /usr/local/inotify.sh
[root@code java]# /usr/local/bin/inotify.sh &
[1] 37984
[root@code java]# chmod +x /usr/local/bin/inotify.sh &
[2] 38016
[root@code java]# jobs
[1]- 运行中 /usr/local/bin/inotify.sh &
[2]+ 完成 chmod +x /usr/local/bin/inotify.sh
[root@code java]# vim /usr/local/bin/inotify.sh[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
export TZ=Asia/Shanghai
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# touch /root/java/testfile
touch: 无法创建"/root/java/testfile": 没有那个文件或目录
[root@code java]# touch /root/app/java/testfile
[root@code java]# sending incremental file list
./
testfilesent 472 bytes received 48 bytes 346.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 426 bytes received 22 bytes 896.00 bytes/sec
total size is 0 speedup is 0.00
^C
[root@code java]# jobs
[1]+ 运行中 /usr/local/bin/inotify.sh &
[root@code java]# tail -n 5 /var/log/rsync.log
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 69.java
2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile
2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile
可以了
问题1不显示时间解决了,推测是格式问题
[root@code bin]# vim /usr/local/bin/inotify.sh
[root@code bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code bin]# pkill -f inotify.sh
[1]+ 已终止 nohup ./inotify.sh
[root@code bin]# nohup ./inotify.sh &
[1] 42179
[root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out"
jobs
[1]+ 运行中 nohup ./inotify.sh &
[root@code bin]# touch /root/app/java/testfile8.java
[root@code bin]# tail -5 /var/log/rsync.log
2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2
2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java
2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java
2025-05-24 20:24:51 fasheng/root/app/java/ CREATE testfile8.java
2025-05-24 20:24:51 fasheng/root/app/java/ ATTRIB testfile8.java
格式问题
推测端口问题也应该要先杀死进程 再重新启动
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code app]# mkdir /java
[root@code app]# ;s
bash: 未预期的符号 `;' 附近有语法错误
[root@code app]# ls
java
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code app]# mkdir /java
mkdir: 无法创建目录"/java": 文件已存在
[root@code app]# ls
java
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code bin]# rm -rf /root/app/java testfile2
[root@code bin]# tail -5 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code bin]# ls /root/app/java
ls: 无法访问/root/app/java: 没有那个文件或目录
[root@code bin]# cd /root/app/java
[root@code app]# cd ./java
[root@code java]# touch {1..4}.java
[root@code java]# ls
1.java 2.java 3.java 4.java
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code java]# jobs
[1]+ 运行中 nohup ./inotify.sh &(工作目录:/usr/local/bin)
[root@code java]# tail -5 /usr/local/bin/nohup.out
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
a:
[root@code java]# touch 5.java
[root@code java]# tail -5 /var/log/rsync.log\
> ^C
[root@code java]#
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
2025-05-24 21:11:50 fasheng/root/app/java/ CREATE 5.java
2025-05-24 21:11:50 fasheng/root/app/java/ ATTRIB 5.java
[root@code java]# tail -5 /usr/local/bin/nohup.out
total size is 0 speedup is 0.00
sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec
total size is 0 speedup is 0.00
[root@code java]# tail -10 /usr/local/bin/nohup.out
sending incremental file list
./
5.javasent 187 bytes received 38 bytes 150.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec
total size is 0 speedup is 0.00
b
复制粘贴到外部环境又失效了b 虚拟机内粘贴了也不行 出来还是粘贴的a的代码
又好了
b
测试成功
若改变shell内容:指定端口 需先断开 再连接
源码
节点a:
[caozx26@code dir1]$ date
2025年 05月 24日 星期六 13:18:31 CST
[caozx26@code dir1]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.235.254 0.0.0.0 UG 0 0 0 ens33
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 ens33
192.168.235.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33
[caozx26@code dir1]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:d6:84:b3 brd ff:ff:ff:ff:ff:ffinet 192.168.235.10/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fed6:84b3/64 scope link valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:d1:59:30 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:d1:59:30 brd ff:ff:ff:ff:ff:ff
[caozx26@code dir1]$ ping 192.168.235.100
PING 192.168.235.100 (192.168.235.100) 56(84) bytes of data.
64 bytes from 192.168.235.100: icmp_seq=1 ttl=64 time=1.50 ms
64 bytes from 192.168.235.100: icmp_seq=2 ttl=64 time=2.64 ms
64 bytes from 192.168.235.100: icmp_seq=3 ttl=64 time=2.84 ms
^C
--- 192.168.235.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2007ms
rtt min/avg/max/mdev = 1.502/2.330/2.843/0.592 ms
[caozx26@code dir1]$ ssh root@192.168.235.100
The authenticity of host '192.168.235.100 (192.168.235.100)' can't be established.
ECDSA key fingerprint is SHA256:PbCAj5CjyP8yLyHMKdEPFFA4planWCr8FpxrrOp3d+I.
ECDSA key fingerprint is MD5:5b:0a:38:81:36:32:b6:38:d1:d8:3b:61:12:39:5a:fc.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.235.100' (ECDSA) to the list of known hosts.
root@192.168.235.100's password:
Permission denied, please try again.
root@192.168.235.100's password:
Last failed login: Sat May 24 13:21:23 CST 2025 from 192.168.235.10 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Sat May 24 13:19:55 2025
[root@backup ~]# exit
登出
Connection to 192.168.235.100 closed.
[caozx26@code dir1]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/caozx26/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/caozx26/.ssh/id_rsa.
Your public key has been saved in /home/caozx26/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/s621fa7t7h6+fwi9z13I6Uo0jasH0ZlebLNJcpeDCI caozx26@code.itcast.cn
The key's randomart image is:
+---[RSA 2048]----+
| |
| . |
| E . * o . |
| . = X o |
| S. + = |
| .. . .. . |
| +o .o * |
| ..Ooo.*=+=|
| .=+Boo=+O/|
+----[SHA256]-----+
[caozx26@code dir1]$ ssh-copy-id root@192.168.235.100
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/caozx26/.ssh/id_rsa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.235.100's password: Number of key(s) added: 1Now try logging into the machine, with: "ssh 'root@192.168.235.100'"
and check to make sure that only the key(s) you wanted were added.[caozx26@code dir1]$ ssh root@192.168.235.100
Last login: Sat May 24 13:21:28 2025 from 192.168.235.10
[root@backup ~]# exit
登出
Connection to 192.168.235.100 closed.
[caozx26@code dir1]$ //mian mi denglu chenggong,jihua pei rsync jiankong
-bash: //mian: 没有那个文件或目录
[caozx26@code dir1]$ cd
[caozx26@code ~]$ ls
公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ ld /
/: 文件无法辨识: 是一个目录
[caozx26@code ~]$ ls /
app boot dir1 dir12 dir2 etc lib media opt root sbin srv tmp var
bin dev dir11 dir13 dir3 home lib64 mnt proc run shop sys usr
[caozx26@code ~]$ cd /app
[caozx26@code app]$ ls
java_project
[caozx26@code app]$ cd /usr/local
[caozx26@code local]$ ls
bin etc games include inotify-tools-3.13 lib lib64 libexec sbin share src
[caozx26@code local]$ cd bin
[caozx26@code bin]$ ls
inotifywait inotifywatch
[caozx26@code bin]$ 2.bianxie bash
bash: 2.bianxie: 未找到命令...
[caozx26@code bin]$ 2.bianxie shell
bash: 2.bianxie: 未找到命令...
[caozx26@code bin]$ huibuhui shi meizhaodao mulu
bash: huibuhui: 未找到命令...
[caozx26@code bin]$ cd /
[caozx26@code /]$ ls
app boot dir1 dir12 dir2 etc lib media opt root sbin srv tmp var
bin dev dir11 dir13 dir3 home lib64 mnt proc run shop sys usr
[caozx26@code /]$ vim inotify.sh
[caozx26@code /]$ dao di shiyong root yonghu haishi yong qita honghu ,qi ru zai shiji huanjing zhong ,bukeneng douyong root yonghu ba
bash: dao: 未找到命令...
[caozx26@code /]$ xian ce yi xia rsync
bash: xian: 未找到命令...
[caozx26@code /]$ ll app
总用量 0
drwxr-xr-x. 5 root root 215 5月 15 21:30 java_project
[caozx26@code /]$ cd /app/java_project
[caozx26@code java_project]$ ls
2.java aa2 file1.java file3.java file5.java file7.java file9.java
aa1 aa3 file2.java file4.java file6.java file8.java
[caozx26@code java_project]$ touch {10..13}.java
touch: 无法创建"10.java": 权限不够
touch: 无法创建"11.java": 权限不够
touch: 无法创建"12.java": 权限不够
touch: 无法创建"13.java": 权限不够
[caozx26@code java_project]$ mkdir -p /home/caozx26/app/java
[caozx26@code java_project]$ cd /home/caozx26
[caozx26@code ~]$ cd app
[caozx26@code app]$ ls
java
[caozx26@code app]$ cd java
[caozx26@code java]$ cai xiang zai shiji shengchanzhong ,yige yonghu yige zhanghao ,huo tongyi zhanghao ,xiangguan daima wenjianjia peizhihao quanxian
bash: cai: 未找到命令...
[caozx26@code java]$ touch {1..6}.java
[caozx26@code java]$ ls
1.java 2.java 3.java 4.java 5.java 6.java
[caozx26@code java]$ rsync /home/caozx26/app/java/ root@192.168.235.100:/backup/app1_java
skipping directory .
[caozx26@code java]$ rsync -av /home/caozx26/app/java root@192.168.235.100:/backup/app1_java
sending incremental file list
java/
java/1.java
java/2.java
java/3.java
java/4.java
java/5.java
java/6.javasent 423 bytes received 134 bytes 371.33 bytes/sec
total size is 0 speedup is 0.00
[caozx26@code java]$ ls
1.java 2.java 3.java 4.java 5.java 6.java
[caozx26@code java]$ rsync -av /home/caozx26/app/java/ root@192.168.235.100:/backup/app1_java
sending incremental file list
./
1.java
2.java
3.java
4.java
5.java
6.javasent 405 bytes received 15,211 bytes 10,410.67 bytes/sec
total size is 0 speedup is 0.00
[caozx26@code java]$ rsync -av --delete /home/caozx26/app/java/ root@192.168.235.100:/backup/app1_java
sending incremental file list
deleting java/6.java
deleting java/5.java
deleting java/4.java
deleting java/3.java
deleting java/2.java
deleting java/1.java
deleting java/
deleting aa3/
deleting aa2/
deleting aa1/
deleting file9.java
deleting file8.java
deleting file7.java
deleting file6.java
deleting file5.java
deleting file4.java
deleting file3.java
deleting file2.java
deleting file1.javasent 168 bytes received 261 bytes 286.00 bytes/sec
total size is 0 speedup is 0.00
[caozx26@code java]$ cd /home/code
-bash: cd: /home/code: 权限不够
[caozx26@code java]$ cd /home/caozx26
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ ll -d /etc
drwxr-xr-x. 145 root root 8192 5月 24 13:17 /etc
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ cd /home/caozx26
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ hostname
code.itcast.cn
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ cd app
[caozx26@code app]$ ls
java
[caozx26@code app]$ ll -d /usr
drwxr-xr-x. 13 root root 155 4月 17 05:01 /usr
[caozx26@code app]$ cd ~
[caozx26@code ~]$ ls
app 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ vim inotify.sh
[caozx26@code ~]$ cat inotify.sh
/usr/lcoal/bin/inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26
[caozx26@code ~]$ cd /usr/local/bin
[caozx26@code bin]$ cd inotifywait
-bash: cd: inotifywait: 不是目录
[caozx26@code bin]$ ls
inotifywait inotifywatch
[caozx26@code bin]$ inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26/app/java
^C
[caozx26@code bin]$ cd /home/caox26/
-bash: cd: /home/caox26/: 没有那个文件或目录
[caozx26@code bin]$ cd /home
[caozx26@code home]$ cd caozx26
[caozx26@code ~]$ cd -
/home
[caozx26@code home]$ cd -
/home/caozx26
[caozx26@code ~]$ ls
app inotify.sh 公共 模板 视频 图片 文档 下载 音乐 桌面
[caozx26@code ~]$ vim inotify.sh
[caozx26@code ~]$ chmod +X inotify.sh
[caozx26@code ~]$ cat inotify.sh
/usr/lcoal/bin/inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26/app/java |while read events
dorsync -av /home/caozx26/app/java/ root@192.168.235.100:/backup/app1_javadone
[caozx26@code ~]$
节点b
[backup@backup ~]$ date
2025年 05月 24日 星期六 13:18:24 CST
[backup@backup ~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:04:f5:98 brd ff:ff:ff:ff:ff:ffinet 192.168.235.100/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe04:f598/64 scope link valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:53:dd:1d brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:53:dd:1d brd ff:ff:ff:ff:ff:ff
[backup@backup ~]$ cd /etc/sshd
-bash: cd: /etc/sshd: 没有那个文件或目录
[backup@backup ~]$ cd /etc/ssh
[backup@backup ssh]$ cat sshd_config
cat: sshd_config: 权限不够
[backup@backup ssh]$ su - caozx26
密码:
上一次登录:六 5月 17 17:37:50 CST 2025pts/2 上
[caozx26@backup ~]$ sudo su
[sudo] caozx26 的密码:
[root@backup caozx26]# cat sshd_config
cat: sshd_config: 没有那个文件或目录
[root@backup caozx26]# cat /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying
#RekeyLimit default none# Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO# Authentication:#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
#GSSAPIEnablek5users no# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
# WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
# problems.
UsePAM yes#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none# no default banner path
#Banner none# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
[root@backup caozx26]# ls
公共 模板 视频 图片 文档 下载 音乐 桌面
[root@backup caozx26]# ls backup
ls: 无法访问backup: 没有那个文件或目录
[root@backup caozx26]# cd /root/backup
bash: cd: /root/backup: 没有那个文件或目录
[root@backup caozx26]# ls /
2010 bin dev home lib64 mnt proc run srv tmp var
backup boot etc lib media opt root sbin sys usr
[root@backup caozx26]# cd /backup
[root@backup backup]# ls
app1_java
[root@backup backup]# cd app1_java
[root@backup app1_java]# ls
2.java aa2 file1.java file3.java file5.java file7.java file9.java
aa1 aa3 file2.java file4.java file6.java file8.java
[root@backup app1_java]# ls
2.java aa2 file1.java file3.java file5.java file7.java file9.java
aa1 aa3 file2.java file4.java file6.java file8.java java
[root@backup app1_java]# ls
1.java 3.java 5.java aa1 aa3 file2.java file4.java file6.java file8.java java
2.java 4.java 6.java aa2 file1.java file3.java file5.java file7.java file9.java
[root@backup app1_java]# ls
1.java 2.java 3.java 4.java 5.java 6.java
[root@backup app1_java]#
a:
p6P�
[root@localhost bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -e "/usr/bin/ssh -p 3712" -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done 您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# cd /root/app/java
[root@localhost java]# ls
35.txt 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
66.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
[root@localhost java]# rm -rf 35.txt
[root@localhost java]# ks
bash: ks: 未找到命令...
[root@localhost java]# ls
66.java 69.java aa3 file20.java file23.java file4.java file7.java
67.java aa1 file19.java file21.java file2.java file5.java
68.java aa2 file1.java file22.java file3.java file6.java
[root@localhost java]# cat /var/log/reync.log
cat: /var/log/reync.log: 没有那个文件或目录
[root@localhost java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# cd /usr/local/bin
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ls
inotify.sh inotifywait inotifywatch nohup.out
[root@localhost bin]# cat nohup.out
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
./inotify.sh:行4: 未预期的符号 `(' 附近有语法错误
./inotify.sh:行4: ` rsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup'
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
[root@localhost bin]# rsync -av /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ssh code@192.168.235.100
ssh: connect to host 192.168.235.100 port 22: Connection refused
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ssh code@192.168.235.100
ssh: connect to host 192.168.235.100 port 22: Connection refused
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ssh code@192.168.235.100
ssh: connect to host 192.168.235.100 port 22: Connection refused
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ssh code@192.168.235.100
ssh: connect to host 192.168.235.100 port 22: Connection refused
[root@localhost bin]# ping 192.168.235.100
PING 192.168.235.100 (192.168.235.100) 56(84) bytes of data.
64 bytes from 192.168.235.100: icmp_seq=1 ttl=64 time=0.323 ms
64 bytes from 192.168.235.100: icmp_seq=2 ttl=64 time=0.423 ms
^C
--- 192.168.235.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.323/0.373/0.423/0.050 ms
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:97:84:5e brd ff:ff:ff:ff:ff:ffinet 192.168.235.20/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe97:845e/64 scope link valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:2a:35:da brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:2a:35:da brd ff:ff:ff:ff:ff:ff
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ssh code@192.168.235.100
Last login: Sat May 24 15:53:31 2025 from 192.168.235.20
[code@code ~]$ rsync /root/app/java code@192.168.235.20:/home/code/backup/java_backup
The authenticity of host '192.168.235.20 (192.168.235.20)' can't be established.
ECDSA key fingerprint is SHA256:RBwUidqa/j7LBfrU3DT4o2bFpnk0zY+aWnLFebYwM8I.
ECDSA key fingerprint is MD5:0b:79:2e:7e:10:00:a6:07:74:f8:66:ee:3e:11:61:c8.
Are you sure you want to continue connecting (yes/no)? ^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(638) [sender=3.1.2]
[code@code ~]$ rsync -av /root/app/java code@192.168.235.100:/home/code/backup/java_backup
The authenticity of host '192.168.235.100 (192.168.235.100)' can't be established.
ECDSA key fingerprint is SHA256:+8RG4GdpTOwlDCCFt0rsKQV5kuZ3v4pWCO/z9qTTqhw.
ECDSA key fingerprint is MD5:e4:f1:b2:d5:1d:87:e6:2a:6a:0d:ef:27:4f:16:8b:df.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.235.100' (ECDSA) to the list of known hosts.
code@192.168.235.100's password:
sending incremental file list
rsync: change_dir "/root/app" failed: Permission denied (13)sent 20 bytes received 12 bytes 1.49 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
[code@code ~]$ ^C
[code@code ~]$ exit
登出
Connection to 192.168.235.100 closed.
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# rsync -av /root/app/java code@192.168.235.100:/home/code/bakcup/java_backup
sending incremental file list
rsync: mkdir "/home/code/bakcup/java_backup" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(657) [Receiver=3.1.2]
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# rsync -av /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup
sending incremental file list
./sent 451 bytes received 29 bytes 960.00 bytes/sec
total size is 0 speedup is 0.00
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# vim /usr/local/bin/rsync.sh
[root@localhost bin]# vim /usr/local/bin/inotify.sh
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date +%F\ %T) fasheng$events" >> /var/log/rsync.log 2>&1
done [root@localhost bin]# cd /root/app/java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# ls
66.java 69.java aa3 file20.java file23.java file4.java file7.java
67.java aa1 file19.java file21.java file2.java file5.java
68.java aa2 file1.java file22.java file3.java file6.java
[root@localhost java]# rm -rf 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
[root@localhost java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
[root@localhost java]# ls
67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java
68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# rm -rf 67.java
[root@localhost java]# ls
68.java aa2 file1.java file22.java file3.java file6.java
69.java aa3 file20.java file23.java file4.java file7.java
aa1 file19.java file21.java file2.java file5.java
[root@localhost java]# cd /usr/local/bin
您在 /var/spool/mail/root 中有邮件
[root@localhost bin]# ls
inotify.sh inotifywait inotifywatch nohup.out
[root@localhost bin]# cat nohup.out
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
./inotify.sh:行4: 未预期的符号 `(' 附近有语法错误
./inotify.sh:行4: ` rsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup'
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
sending incremental file list
deleting 66.java
deleting 35.txt
./sent 437 bytes received 50 bytes 324.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 67.java
./sent 418 bytes received 40 bytes 916.00 bytes/sec
total size is 0 speedup is 0.00
[root@localhost bin]# cd /root/app/java
您在 /var/spool/mail/root 中有邮件
[root@localhost java]# ls
68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java
[root@localhost java]# touch aa{4..5}
[root@localhost java]# ls
68.java 69.java aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java
[root@localhost java]# 登出
[caozx26@localhost /]$ cd -
/shop
[caozx26@localhost shop]$ cd -
/
[caozx26@localhost /]$ sudo su
[sudo] caozx26 的密码:
[root@code /]# cd -
bash: cd: OLDPWD 未设定
[root@code /]# cat /usr/bin/local/nohup.out
cat: /usr/bin/local/nohup.out: 没有那个文件或目录
[root@code /]# cat /usr/local/bin/nohup.out
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
./inotify.sh:行4: 未预期的符号 `(' 附近有语法错误
./inotify.sh:行4: ` rsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup'
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
sending incremental file list
deleting 66.java
deleting 35.txt
./sent 437 bytes received 50 bytes 324.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 67.java
./sent 418 bytes received 40 bytes 916.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
./
aa4
aa5sent 528 bytes received 67 bytes 396.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 310.00 bytes/sec
total size is 0 speedup is 0.00
[root@code /]# cd /usr/local/bin
[root@code bin]# ls
inotify.sh inotifywait inotifywatch nohup.out
[root@code bin]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE aa4
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa4
'date+%F\ %T' fasheng/root/app/java/ CREATE aa5
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
[root@code bin]# vim inotify.sh
[root@code bin]# cat inotift.sh
cat: inotift.sh: 没有那个文件或目录
[root@code bin]# cat inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "'date +%F\ %T' fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code bin]# cd /root/app/java
[root@code java]# ls
68.java 69.java aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java
[root@code java]# rm -rf 68.java
[root@code java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE aa4
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa4
'date+%F\ %T' fasheng/root/app/java/ CREATE aa5
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
[root@code java]# cat /usr/local/bin/inotfy.sh
cat: /usr/local/bin/inotfy.sh: 没有那个文件或目录
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "'date +%F\ %T' fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# vim /usr/local/bin/inotify.sh
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# ls
69.java aa2 aa4 file19.java file20.java file22.java file2.java file4.java file6.java
aa1 aa3 aa5 file1.java file21.java file23.java file3.java file5.java file7.java
[root@code java]# rm -rf 69.java
[root@code java]# cat /var/log/rsync.log
2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2)
2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:14:43 [44477] building file list
2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0
2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100)
2025/05/20 13:40:01 [46901] building file list
2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456
2025/05/21 12:50:38 [61037] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:50:38 [61037] building file list
2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456
2025/05/21 12:57:38 [61741] rsync on app/ from boss1@UNKNOWN (192.168.235.100)
2025/05/21 12:57:38 [61741] building file list
2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456
'date+%F\ %T' fasheng/root/app/java/ CREATE 321.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 321.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 21.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 21.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 34.txt
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 34.txt
'date+%F\ %T' fasheng/root/app/java/ CREATE 322.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 322.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 333.java
'date+%F\ %T' fasheng/root/app/java/ MODIFY 333.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 66.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 66.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 67.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 68.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 68.java
'date+%F\ %T' fasheng/root/app/java/ CREATE 69.java
'date+%F\ %T' fasheng/root/app/java/ ATTRIB 69.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 21.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 321.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 322.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 333.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 34.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 35.txt
'date+%F\ %T' fasheng/root/app/java/ DELETE 66.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 67.java
'date+%F\ %T' fasheng/root/app/java/ CREATE aa4
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa4
'date+%F\ %T' fasheng/root/app/java/ CREATE aa5
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 69.java
[root@code java]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 35 4月 19 17:20 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@code java]# /usr/local/bin/inotify.java
bash: /usr/local/bin/inotify.java: 没有那个文件或目录
[root@code java]# /usr/local/bin/inotify.sh
jobs
^C
[root@code java]# vim /usr/local/bin/inotify.sh
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# pkill -f inotify.sh
[root@code java]# /usr/local/bin/inotify/sh &
[1] 37918
[root@code java]# bash: /usr/local/bin/inotify/sh: 没有那个文件或目录
^C
[1]+ 退出 127 /usr/local/bin/inotify/sh
[root@code java]# /usr/local/inotify.sh &
[1] 37968
[root@code java]# bash: /usr/local/inotify.sh: 没有那个文件或目录
^C
[1]+ 退出 127 /usr/local/inotify.sh
[root@code java]# /usr/local/bin/inotify.sh &
[1] 37984
[root@code java]# chmod +x /usr/local/bin/inotify.sh &
[2] 38016
[root@code java]# jobs
[1]- 运行中 /usr/local/bin/inotify.sh &
[2]+ 完成 chmod +x /usr/local/bin/inotify.sh
[root@code java]# vim /usr/local/bin/inotify.sh
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
export TZ=Asia/Shanghai
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# touch /root/java/testfile
touch: 无法创建"/root/java/testfile": 没有那个文件或目录
[root@code java]# touch /root/app/java/testfile
[root@code java]# sending incremental file list
./
testfilesent 472 bytes received 48 bytes 346.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 426 bytes received 22 bytes 896.00 bytes/sec
total size is 0 speedup is 0.00
^C
[root@code java]# jobs
[1]+ 运行中 /usr/local/bin/inotify.sh &
[root@code java]# tail -n 5 /var/log/rsync.log
'date+%F\ %T' fasheng/root/app/java/ ATTRIB aa5
'date+%F\ %T' fasheng/root/app/java/ DELETE 68.java
'date+%F\ %T' fasheng/root/app/java/ DELETE 69.java
2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile
2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile
[root@code java]# touch /root/java/testfile2
touch: 无法创建"/root/java/testfile2": 没有那个文件或目录
[root@code java]# touch /root/app/java/testfile2
[root@code java]# sending incremental file list
./
testfile2sent 489 bytes received 48 bytes 1,074.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec
total size is 0 speedup is 0.00
^C
[root@code java]# tail -5 /var/log/rsync.log
'date+%F\ %T' fasheng/root/app/java/ DELETE 69.java
2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile
2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile
2025-05-24 19:43:47 fasheng/root/app/java/ CREATE testfile2
2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
export TZ=Asia/Shanghai
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# pkill -f inotify.sh
[1]+ 已终止 /usr/local/bin/inotify.sh
[root@code java]# nohup ./inotify.sh &
[1] 38600
[root@code java]# nohup: 忽略输入并把输出追加到"nohup.out"
nohup: 无法运行命令"./inotify.sh": 没有那个文件或目录
^C
[1]+ 退出 127 nohup ./inotify.sh
[root@code java]# cd /usr/local/bin
[root@code bin]# ls
inotify.sh inotifywait inotifywatch nohup.out
[root@code bin]# jobs
[root@code bin]# nohup ./inotify.sh &
[1] 39922
[root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out"
jpnd
bash: jpnd: 未找到命令...
[root@code bin]# jobd
bash: jobd: 未找到命令...
[root@code bin]# jobs
[1]+ 运行中 nohup ./inotify.sh &
[root@code bin]# touch /root/app/java/testfile4.java
[root@code bin]# tail -5 /var/log/rsync.log
2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile
2025-05-24 19:43:47 fasheng/root/app/java/ CREATE testfile2
2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2
2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java
2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java
[root@code bin]# vim /usr/local/bin/inotify.sh
[root@code bin]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code bin]# pkill -f inotify.sh
[1]+ 已终止 nohup ./inotify.sh
[root@code bin]# nohup ./inotify.sh &
[1] 42179
[root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out"
jobs
[1]+ 运行中 nohup ./inotify.sh &
[root@code bin]# touch /root/app/java/testfile8.java
[root@code bin]# tail -5 /var/log/rsync.log
2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2
2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java
2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java
2025-05-24 20:24:51 fasheng/root/app/java/ CREATE testfile8.java
2025-05-24 20:24:51 fasheng/root/app/java/ ATTRIB testfile8.java
[root@code bin]# rm -rf /root/app/java testfile2
[root@code bin]# tail -5 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code bin]# ls /root/app/java
ls: 无法访问/root/app/java: 没有那个文件或目录
[root@code bin]# cd /root/app/java
bash: cd: /root/app/java: 没有那个文件或目录
[root@code bin]# cd /root/app
[root@code app]# ;s
bash: 未预期的符号 `;' 附近有语法错误
[root@code app]# ls
[root@code app]# ls
[root@code app]# touch java
[root@code app]# ls
java
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code app]# mkdir /java
[root@code app]# ;s
bash: 未预期的符号 `;' 附近有语法错误
[root@code app]# ls
java
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code app]# mkdir /java
mkdir: 无法创建目录"/java": 文件已存在
[root@code app]# ls
java
[root@code app]# cd java
bash: cd: java: 不是目录
[root@code app]# rm rf java
rm: 无法删除"rf": 没有那个文件或目录
rm:是否删除普通空文件 "java"?y
[root@code app]# ls
[root@code app]# mkdir ./java
[root@code app]# ls
java
[root@code app]# touch ./java {1..4}.java
[root@code app]# cd java
[root@code java]# ls
[root@code java]# cd -
/root/app
[root@code app]# ls
1.java 2.java 3.java 4.java java
[root@code app]# touch -p ./java {1..4}.java
touch:无效选项 -- p
Try 'touch --help' for more information.
[root@code app]# cd ./java
[root@code java]# touch {1..4}.java
[root@code java]# ls
1.java 2.java 3.java 4.java
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code java]# jobs
[1]+ 运行中 nohup ./inotify.sh &(工作目录:/usr/local/bin)
[root@code java]# tail -10 /usr/local/bin/nohup.outsent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
[root@code java]# tail -20 /usr/local/bin/nohup.out
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
[root@code java]# kill -f inotify.sh
bash: kill: f: 无效的信号声明
[root@code java]# pkill -f inotify.sh
[1]+ 已终止 nohup ./inotify.sh(工作目录:/usr/local/bin)
(当前工作目录:~/app/java)
[root@code java]# cd /usr/local/bin/
[root@code bin]# nohup ./inotify.sh &
[1] 44327
[root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out"
jobs
[1]+ 运行中 nohup ./inotify.sh &
[root@code bin]# tail -6 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code bin]# cd /root/app/java
[root@code java]# ls
1.java 2.java 3.java 4.java
[root@code java]# cat /usr/local/bin/nohup.out
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
./inotify.sh:行4: 未预期的符号 `(' 附近有语法错误
./inotify.sh:行4: ` rsync -e(ssh -p 3712) -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup'
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
ssh: connect to host 192.168.235.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
sending incremental file list
deleting 66.java
deleting 35.txt
./sent 437 bytes received 50 bytes 324.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 67.java
./sent 418 bytes received 40 bytes 916.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
./
aa4
aa5sent 528 bytes received 67 bytes 396.67 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 443 bytes received 22 bytes 310.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 68.java
./sent 427 bytes received 36 bytes 926.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
deleting 69.java
./sent 410 bytes received 40 bytes 300.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
./
nohup.out
testfile4.javasent 588 bytes received 67 bytes 1,310.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 503 bytes received 22 bytes 350.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
./
testfile8.javasent 571 bytes received 48 bytes 1,238.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 525 bytes received 22 bytes 1,094.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
sending incremental file list
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
[root@code java]# tail -5 /usr/local/bin/nohup.out
rsync: change_dir "/root/app/java" failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]
[root@code java]# rsync -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup
sending incremental file list
deleting file7.java/
deleting file6.java/
deleting file5.java/
deleting file4.java/
deleting file3.java/
deleting file2.java/
deleting file1.java/
deleting aa3/
deleting aa2/
deleting aa1/
deleting testfile8.java
deleting testfile4.java
deleting testfile2
deleting testfile
deleting nohup.out
deleting file23.java
deleting file22.java
deleting file21.java
deleting file20.java
deleting file19.java
deleting aa5
deleting aa4
./
1.java
2.java
3.java
4.javasent 279 bytes received 387 bytes 1,332.00 bytes/sec
total size is 0 speedup is 0.00
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
[root@code java]# ls
1.java 2.java 3.java 4.java
[root@code java]# touch 5.java
[root@code java]# tail -5 /var/log/rsync.log\
> ^C
[root@code java]#
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java
2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java
2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED
2025-05-24 21:11:50 fasheng/root/app/java/ CREATE 5.java
2025-05-24 21:11:50 fasheng/root/app/java/ ATTRIB 5.java
[root@code java]# tail -5 /usr/local/bin/nohup.out
total size is 0 speedup is 0.00
sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec
total size is 0 speedup is 0.00
[root@code java]# tail -10 /usr/local/bin/nohup.out
sending incremental file list
./
5.javasent 187 bytes received 38 bytes 150.00 bytes/sec
total size is 0 speedup is 0.00
sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec
total size is 0 speedup is 0.00
[root@code java]# ssh -p 3333 code@192.168.235.100
Last login: Sat May 24 18:38:16 2025 from 192.168.235.20
[code@code ~]$ exit
登出
Connection to 192.168.235.100 closed.
[root@code java]# vim /usr/local/bin/inotify.sh
[root@code java]# cat /usr/local/bin/inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events
dorsync -av -e "ssh -p 3333" --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup/echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done [root@code java]# pkill -f inotify.sh
[1]+ 已终止 nohup ./inotify.sh(工作目录:/usr/local/bin)
(当前工作目录:~/app/java)
[root@code java]# nohup /usr/local/bin/inotify.sh &
[1] 48232
[root@code java]# nohup: 忽略输入并把输出追加到"nohup.out"
jobs
[1]+ 运行中 nohup /usr/local/bin/inotify.sh &
[root@code java]# ls
1.java 2.java 3.java 4.java 5.java nohup.out
[root@code java]# touch 7.java
[root@code java]# ls
1.java 2.java 3.java 4.java 5.java 7.java nohup.out
[root@code java]# tail -5 /var/log/rsync.log
2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out
2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out
2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out
2025-05-24 21:28:15 fasheng/root/app/java/ MODIFY nohup.out
2025-05-24 21:28:15 fasheng/root/app/java/ MODIFY nohup.out
[root@code java]# rsync -e "ssh -p 3333" -av --delete /root/app/java/ code@192.168.235.100:/home/code/backup/java_backup
sending incremental file list
nohup.outsent 1,200 bytes received 1,061 bytes 1,507.33 bytes/sec
total size is 119,281 speedup is 52.76
[root@code java]# cd /root/app/javqa
bash: cd: /root/app/javqa: 没有那个文件或目录
[root@code java]# cd /root/app/java
[root@code java]# ls
1.java 2.java 3.java 4.java 5.java 7.java nohup.out
[root@code java]# tail -10 nohup.out
sending incremental file list
nohup.outsent 1,594 bytes received 1,607 bytes 6,402.00 bytes/sec
total size is 183,011 speedup is 57.17
sending incremental file list
nohup.outsent 1,733 bytes received 1,607 bytes 2,226.67 bytes/sec
total size is 183,151 speedup is 54.84
[root@code java]# tail -20 nohup.out
sending incremental file list
nohup.outsent 1,941 bytes received 1,709 bytes 2,433.33 bytes/sec
total size is 195,191 speedup is 53.48
sending incremental file list
nohup.outsent 2,082 bytes received 1,709 bytes 7,582.00 bytes/sec
total size is 195,331 speedup is 51.52
sending incremental file list
nohup.outsent 1,499 bytes received 1,715 bytes 6,428.00 bytes/sec
total size is 195,471 speedup is 60.82
sending incremental file list
nohup.outsent 1,665 bytes received 1,715 bytes 2,253.33 bytes/sec
total size is 195,611 speedup is 57.87
[root@code java]# is 57. 1,715 bytes 2,253.33 bytes/sec
bash: is: 未找到命令...
[root@code java]# 1,715 bytes1,715 bytes list
bash: 1,715: 未找到命令...
[root@code java]# 2,433.33forever bytesforever
在这里插入代码片
b:
在这里插入代码片