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 419 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 524 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 417 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
密码:
上一次登录:六 517 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:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

[root@localhost java_backup]# date
2025年 05月 24日 星期六 08:10:28 CST
[root@localhost java_backup]# ls
35.txt  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  java
[root@localhost java_backup]# ll 
总用量 6148
-rw-r--r--.  1 code code 6291456 520 21:37 35.txt
drwxr-xr-x.  2 code code       6 519 22:32 aa1
drwxr-xr-x.  2 code code       6 519 22:32 aa2
drwxr-xr-x.  2 code code       6 519 22:32 aa3
-rw-r--r--.  1 code code       0 520 21:38 file19.java
drwxr-xr-x.  2 code code       6 519 22:30 file1.java
-rw-r--r--.  1 code code       0 520 21:38 file20.java
-rw-r--r--.  1 code code       0 520 21:38 file21.java
-rw-r--r--.  1 code code       0 520 21:38 file22.java
-rw-r--r--.  1 code code       0 520 21:38 file23.java
drwxr-xr-x.  2 code code       6 519 22:30 file2.java
drwxr-xr-x.  2 code code       6 519 22:30 file3.java
drwxr-xr-x.  2 code code       6 519 22:30 file4.java
drwxr-xr-x.  2 code code       6 519 22:30 file5.java
drwxr-xr-x.  2 code code       6 519 22:30 file6.java
drwxr-xr-x.  2 code code       6 519 22:30 file7.java
drwxr-xr-x. 12 code code    4096 523 22:36 java
[root@localhost java_backup]# cd /home/code/backup/java_backup
[root@localhost java_backup]# ls
35.txt  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  java
[root@localhost java_backup]# cd java
[root@localhost java]# ls
21.java  321.java  322.java  333.java  34.txt  35.txt  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]# ll 
总用量 14336
-rw-r--r--. 1 code code       0 523 22:18 21.java
-rw-r--r--. 1 code code 3145728 523 22:07 321.java
-rw-r--r--. 1 code code 2097152 523 22:26 322.java
-rw-r--r--. 1 code code 3145728 523 22:36 333.java
-rw-r--r--. 1 code code       0 523 22:22 34.txt
-rw-r--r--. 1 code code 6291456 520 21:37 35.txt
drwxr-xr-x. 2 code code       6 519 22:32 aa1
drwxr-xr-x. 2 code code       6 519 22:32 aa2
drwxr-xr-x. 2 code code       6 519 22:32 aa3
-rw-r--r--. 1 code code       0 520 21:38 file19.java
drwxr-xr-x. 2 code code       6 519 22:30 file1.java
-rw-r--r--. 1 code code       0 520 21:38 file20.java
-rw-r--r--. 1 code code       0 520 21:38 file21.java
-rw-r--r--. 1 code code       0 520 21:38 file22.java
-rw-r--r--. 1 code code       0 520 21:38 file23.java
drwxr-xr-x. 2 code code       6 519 22:30 file2.java
drwxr-xr-x. 2 code code       6 519 22:30 file3.java
drwxr-xr-x. 2 code code       6 519 22:30 file4.java
drwxr-xr-x. 2 code code       6 519 22:30 file5.java
drwxr-xr-x. 2 code code       6 519 22:30 file6.java
drwxr-xr-x. 2 code code       6 519 22:30 file7.java
[root@localhost java]# cd -
/home/code/backup/java_backup
[root@localhost java_backup]# ls
21.java  321.java  322.java  333.java  34.txt  35.txt  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  java
[root@localhost java_backup]# ll
总用量 14340
-rw-r--r--.  1 code code       0 523 22:18 21.java
-rw-r--r--.  1 code code 3145728 523 22:07 321.java
-rw-r--r--.  1 code code 2097152 523 22:26 322.java
-rw-r--r--.  1 code code 3145728 523 22:36 333.java
-rw-r--r--.  1 code code       0 523 22:22 34.txt
-rw-r--r--.  1 code code 6291456 520 21:37 35.txt
drwxr-xr-x.  2 code code       6 519 22:32 aa1
drwxr-xr-x.  2 code code       6 519 22:32 aa2
drwxr-xr-x.  2 code code       6 519 22:32 aa3
-rw-r--r--.  1 code code       0 520 21:38 file19.java
drwxr-xr-x.  2 code code       6 519 22:30 file1.java
-rw-r--r--.  1 code code       0 520 21:38 file20.java
-rw-r--r--.  1 code code       0 520 21:38 file21.java
-rw-r--r--.  1 code code       0 520 21:38 file22.java
-rw-r--r--.  1 code code       0 520 21:38 file23.java
drwxr-xr-x.  2 code code       6 519 22:30 file2.java
drwxr-xr-x.  2 code code       6 519 22:30 file3.java
drwxr-xr-x.  2 code code       6 519 22:30 file4.java
drwxr-xr-x.  2 code code       6 519 22:30 file5.java
drwxr-xr-x.  2 code code       6 519 22:30 file6.java
drwxr-xr-x.  2 code code       6 519 22:30 file7.java
drwxr-xr-x. 12 code code    4096 523 22:36 java
[root@localhost java_backup]# ll
总用量 14340
-rw-r--r--.  1 code code       0 523 22:18 21.java
-rw-r--r--.  1 code code 3145728 523 22:07 321.java
-rw-r--r--.  1 code code 2097152 523 22:26 322.java
-rw-r--r--.  1 code code 3145728 523 22:36 333.java
-rw-r--r--.  1 code code       0 523 22:22 34.txt
-rw-r--r--.  1 code code 6291456 520 21:37 35.txt
drwxr-xr-x.  2 code code       6 519 22:32 aa1
drwxr-xr-x.  2 code code       6 519 22:32 aa2
drwxr-xr-x.  2 code code       6 519 22:32 aa3
-rw-r--r--.  1 code code       0 520 21:38 file19.java
drwxr-xr-x.  2 code code       6 519 22:30 file1.java
-rw-r--r--.  1 code code       0 520 21:38 file20.java
-rw-r--r--.  1 code code       0 520 21:38 file21.java
-rw-r--r--.  1 code code       0 520 21:38 file22.java
-rw-r--r--.  1 code code       0 520 21:38 file23.java
drwxr-xr-x.  2 code code       6 519 22:30 file2.java
drwxr-xr-x.  2 code code       6 519 22:30 file3.java
drwxr-xr-x.  2 code code       6 519 22:30 file4.java
drwxr-xr-x.  2 code code       6 519 22:30 file5.java
drwxr-xr-x.  2 code code       6 519 22:30 file6.java
drwxr-xr-x.  2 code code       6 519 22:30 file7.java
drwxr-xr-x. 12 code code    4096 523 22:36 java
[root@localhost java_backup]# dd if=/dev/zero of=12.java bs=12M count=1
记录了1+0 的读入
记录了1+0 的写出
12582912字节(13 MB)已复制,0.0460731 秒,273 MB/秒
[root@localhost java_backup]# ls
12.java  321.java  333.java  35.txt  aa2  file19.java  file20.java  file22.java  file2.java  file4.java  file6.java  java
21.java  322.java  34.txt    aa1     aa3  file1.java   file21.java  file23.java  file3.java  file5.java  file7.java
[root@localhost java_backup]# ls
21.java  321.java  322.java  333.java  34.txt  35.txt  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_backup]# ls
21.java   333.java  aa1  file19.java  file21.java  file2.java  file5.java
321.java  34.txt    aa2  file1.java   file22.java  file3.java  file6.java
322.java  35.txt    aa3  file20.java  file23.java  file4.java  file7.java
[root@localhost java_backup]# ls
21.java   333.java  aa1  file19.java  file21.java  file2.java  file5.java
321.java  34.txt    aa2  file1.java   file22.java  file3.java  file6.java
322.java  35.txt    aa3  file20.java  file23.java  file4.java  file7.java
[root@localhost java_backup]# ls
21.java   333.java  aa1  file19.java  file21.java  file2.java  file5.java
321.java  34.txt    aa2  file1.java   file22.java  file3.java  file6.java
322.java  35.txt    aa3  file20.java  file23.java  file4.java  file7.java
[root@localhost java_backup]# ls
21.java   333.java  aa1  file19.java  file21.java  file2.java  file5.java
321.java  34.txt    aa2  file1.java   file22.java  file3.java  file6.java
322.java  35.txt    aa3  file20.java  file23.java  file4.java  file7.java
[root@localhost java_backup]# ls
21.java   333.java  66.java  69.java  aa3          file20.java  file23.java  file4.java  file7.java
321.java  34.txt    67.java  aa1      file19.java  file21.java  file2.java   file5.java
322.java  35.txt    68.java  aa2      file1.java   file22.java  file3.java   file6.java
[root@localhost java_backup]# ls
21.java  321.java  322.java  333.java  34.txt  35.txt  66.java  67.java  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_backup]# ls
21.java  321.java  322.java  333.java  34.txt  35.txt  66.java  67.java  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_backup]# ls
322.java  333.java  34.txt  35.txt  66.java  67.java  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_backup]# ls
34.txt  35.txt  66.java  67.java  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_backup]# ls
34.txt  35.txt  66.java  67.java  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_backup]# ls
34.txt  66.java  68.java  aa1  aa3          file1.java   file21.java  file23.java  file3.java  file5.java  file7.java
35.txt  67.java  69.java  aa2  file19.java  file20.java  file22.java  file2.java   file4.java  file6.java
[root@localhost java_backup]# 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 3712
#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 No
#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@localhost java_backup]# netstat -tuln |grep 3712
tcp        0      0 0.0.0.0:3712            0.0.0.0:*               LISTEN     
tcp6       0      0 :::3712                 :::*                    LISTEN     
[root@localhost java_backup]# 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_backup]# 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_backup]# cat /etc/sshd/ssh_config
cat: /etc/sshd/ssh_config: 没有那个文件或目录
[root@localhost java_backup]# cd /etc/sshd
bash: cd: /etc/sshd: 没有那个文件或目录
[root@localhost java_backup]# cd /etc/ssh
[root@localhost ssh]# vim sshd_config
[root@localhost ssh]# cat 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 No
#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@localhost ssh]# cd
[root@localhost ~]# cd /home/code
[root@localhost code]# cd backup
[root@localhost backup]# ls
java_backup
[root@localhost backup]# systemctl restart network
[root@localhost backup]# cd
[root@localhost ~]# 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 No
#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@localhost ~]# 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:e9:ad:9e brd ff:ff:ff:ff:ff:ffinet 192.168.235.100/24 brd 192.168.235.255 scope global noprefixroute ens33valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:f5:ea:28 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:f5:ea:28 brd ff:ff:ff:ff:ff:ff
[root@localhost ~]# tail -5 /etc/passwd
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
caozx26420:x:1000:1000:caozx26420:/home/caozx26420:/bin/bash
code:x:1001:1001::/home/code:/bin/bash
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# cd /home/code/backup/java_backup
[root@localhost java_backup]# ls
67.java  aa1  file19.java  file21.java  file2.java  file5.java
68.java  aa2  file1.java   file22.java  file3.java  file6.java
69.java  aa3  file20.java  file23.java  file4.java  file7.java
[root@localhost java_backup]# 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_backup]# 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_backup]# ls
aa1  aa3  aa5          file1.java   file21.java  file23.java  file3.java  file5.java  file7.java
aa2  aa4  file19.java  file20.java  file22.java  file2.java   file4.java  file6.java
[root@localhost java_backup]# ls
aa1  aa4          file1.java   file22.java  file3.java  file6.java  testfile
aa2  aa5          file20.java  file23.java  file4.java  file7.java  testfile2
aa3  file19.java  file21.java  file2.java   file5.java  nohup.out   testfile4.java
[root@localhost java_backup]# ls
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  nohup.out  testfile  testfile2  testfile4.java  testfile8.java
[root@localhost java_backup]# ls
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  nohup.out  testfile  testfile2  testfile4.java  testfile8.java
[root@localhost java_backup]# ls
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  nohup.out  testfile  testfile2  testfile4.java  testfile8.java
[root@localhost java_backup]# ls
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  nohup.out  testfile  testfile2  testfile4.java  testfile8.java
[root@localhost java_backup]# ls
1.java  2.java  3.java  4.java
[root@localhost java_backup]# ls
1.java  2.java  3.java  4.java  5.java
[root@localhost java_backup]# 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 No
#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@localhost java_backup]# vim /etc/ssh/sshd_config
[root@localhost java_backup]# 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 3333
#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 No
#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@localhost java_backup]# [root@localhost java_backup]# ls
bash: [root@localhost: 未找到命令...
[root@localhost java_backup]# 1.java  2.java  3.java  4.java  5.java
bash: 1.java: 未找到命令...
[root@localhost java_backup]# .java .java  5.java
bash: .java: 未找到命令...
相似命令是: 'java'
[root@localhost java_backup]# systemctl restart sshd
[root@localhost java_backup]# ls
1.java  2.java  3.java  4.java  5.java  7.java  nohup.out
[root@localhost java_backup]# 

参考

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/news/906885.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python入门手册:条件判断

条件判断是编程中不可或缺的一部分&#xff0c;它允许程序根据不同的条件执行不同的代码块。Python提供了if、elif和else语句来实现条件判断。通过这些语句&#xff0c;你可以控制程序的流程&#xff0c;使其能够根据不同的情况做出相应的反应。本文将详细介绍Python中的条件判…

x-cmd install | cargo-selector:优雅管理 Rust 项目二进制与示例,开发体验升级

目录 功能亮点安装优势特点适用场景总结 还在为 Rust 项目中众多的二进制文件和示例而烦恼吗&#xff1f;cargo-selector 让你告别繁琐的命令行&#xff0c;轻松选择并运行目标程序&#xff01; 功能亮点 交互式选择&#xff1a; 在终端中以交互方式浏览你的二进制文件和示例&…

Baklib知识中台高效实践路径

知识中台全周期构建路径 Baklib在构建知识中台全周期管理体系时&#xff0c;以知识价值转化为核心导向&#xff0c;通过三阶段递进实现闭环运作。在知识采集阶段&#xff0c;运用智能爬虫与API接口技术&#xff0c;聚合分散在业务系统、文档库及沟通工具中的碎片化知识资产&am…

mapbox进阶,手写放大镜功能

👨‍⚕️ 主页: gis分享者 👨‍⚕️ 感谢各位大佬 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍⚕️ 收录于专栏:mapbox 从入门到精通 文章目录 一、🍀前言1.1 ☘️mapboxgl.Map 地图对象1.1 ☘️mapboxgl.Map style属性二、🍀手写放大镜功能1. ☘️实现思路2. ☘️…

康佳Java开发面试题及参考答案

面向对象三大特性是什么&#xff1f;请举例说明多态。 面向对象编程&#xff08;OOP&#xff09;的三大核心特性是封装、继承和多态。封装是将数据和操作数据的方法绑定在一起&#xff0c;并隐藏对象的内部实现细节&#xff1b;继承允许一个类继承另一个类的属性和方法&#x…

Spark集群架构解析:核心组件与Standalone、YARN模式深度对比(AM,Container,Driver,Executor)

一、核心组件定义与关系拆解 1. ApplicationMaster&#xff08;AM&#xff09; 定义&#xff1a;YARN 框架中的应用管理器&#xff0c;每个应用程序&#xff08;如 Spark 作业&#xff09;对应一个 AM。职责&#xff1a; 向 YARN 的 ResourceManager 申请资源&#xff08;Con…

IS-IS报文

前言&#xff1a; IS-IS采用分层架构&#xff0c;所有Level-2和Level 1-2路由器构成了骨干区域&#xff0c;同一区域的Level-1路由器构成了普通区域IS-IS支持三种认证方式&#xff0c;分别是接口认证、区域认证、路由域认证IS-IS有四种报文类型&#xff0c;分别是IIH、CSNP、P…

【Flutter】多语言适配-波斯语RTL从右到左

前言 在多语言适配的时候&#xff0c;波斯语的显示是从右到左的&#xff0c;需要针对一些控件进行单独适配。 核心逻辑&#xff1a;根据语言动态设置 Directionality Widget build(BuildContext context) {final isRtl Localizations.localeOf(context).languageCode fa;r…

【VSCode】在远程服务器Linux 系统 实现 Anaconda 安装与下载

【远程服务器】Anaconda 安装与下载 一、 安装Anaconda【方式一】直接在远程服务器下载&#xff0c;通过 wget 命令:【方式二】在本地电脑下载&#xff0c;在同意 vscode上传到服务器二、配置环境变量 本文基于 VSCode 进行远程服务器的配置&#xff0c;VSCode 相关安装可参考下…

【深度学习-Day 17】神经网络的心脏:反向传播算法全解析

Langchain系列文章目录 01-玩转LangChain&#xff1a;从模型调用到Prompt模板与输出解析的完整指南 02-玩转 LangChain Memory 模块&#xff1a;四种记忆类型详解及应用场景全覆盖 03-全面掌握 LangChain&#xff1a;从核心链条构建到动态任务分配的实战指南 04-玩转 LangChai…

线性回归神经网络从0到1

1.线性方程和向量乘法 深度学习的基础就是从线性回归方程的理论进入的。简单的线性回归方程为 比如大家日常中买房子&#xff0c;价格受到哪些因素影响呢&#xff1f; 比如房龄、交通、是否是学区、有无配套超市、公园&#xff0c;这些基本是外部条件&#xff0c;内部条件诸如…

11|省下钱买显卡,如何利用开源模型节约成本?

不知道课程上到这里&#xff0c;你账户里免费的5美元的额度还剩下多少了&#xff1f;如果你尝试着完成我给的几个数据集里的思考题&#xff0c;相信这个额度应该是不太够用的。而ChatCompletion的接口&#xff0c;又需要传入大量的上下文信息&#xff0c;实际消耗的Token数量其…

文章代码|皮层/表皮特异性转录因子 bZIP89 的自然变异决定了玉米侧根发育和抗旱能力

数据和材料可用性&#xff1a;评估本文结论所需的所有数据都包含在论文和/或补充材料中。本研究中的大量 RNA-seq 读数存放在 NCBI 序列读取档案 &#xff08;www.ncbi.nlm.nih.gov/sra&#xff09; 中&#xff0c;登录代码为 SRP446501/PRJNA980895。scRNA-seq、DAP-seq 和 DN…

铠大师:让用户畅享多元应用,助力鸿蒙生态发展

在全球信息技术产业格局加速重构的背景下&#xff0c;中国科技力量正以开放包容的姿态重塑操作系统生态范式。 5月19日&#xff0c;华为在成都举办的nova14系列及鸿蒙电脑新品发布会上&#xff0c;正式对外发布搭载了鸿蒙系统的笔记本电脑HUAWEI MateBook Pro与HUAWEI MateBoo…

初学Transformer架构和注意力机制

文章目录 说明一 LLM 简介二 Transformer 架构2.1 Transformer的架构组成2.1.1 输入嵌入 (Input Embedding)2.1.2 编码器 (Encoder) 的结构解码器 (Decoder) 的结构2.1.3 输出层 (Output Layer)结构 2.2 编码和解码器的独立输入理解 三 注意力机制 说明 本文适合初学者&#x…

基于PySide6与pycatia的CATIA几何阵列生成器开发实践

引言:参数化设计的工业价值 在航空航天、汽车制造等领域,复杂几何图案的批量生成是模具设计与机械加工的核心需求。传统手动建模方式存在效率低下、参数调整困难等问题。本文基于PySide6+pycatia技术栈,实现了一套支持​​动态参数配置​​、​​智能几何阵列生成​​的自动…

PDF 编辑批量拆分合并OCR 识别

各位办公小能手们&#xff01;你们有没有过被PDF文件折磨得死去活来的经历&#xff1f;反正我是有&#xff0c;每次要编辑PDF&#xff0c;那叫一个费劲啊&#xff01;不过呢&#xff0c;今天我要给大家介绍一款神器——WPS PDF to Word&#xff0c;有了它&#xff0c;PDF编辑那…

棒球比赛暗号百科·棒球1号位

关于棒球比赛暗号百科介绍&#xff0c;涵盖基本概念、历史演变、常见类型及经典案例&#xff1a; 棒球比赛暗号百科 一、定义与作用 棒球暗号是球员、教练团队通过手势、动作、语言或道具传递战术指令的密码系统&#xff0c;旨在隐蔽沟通攻防策略&#xff0c;避免对手破解。其…

Python实现基于线性回归的空气质量预测系统并达到目标指标

为了实现基于线性回归的空气质量预测系统并达到目标指标&#xff0c;以下是完整的Python代码实现&#xff1a; import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.preprocessing import StandardScal…

236.二叉树的最近公共祖先

在树结构中&#xff0c;祖先指的是一个节点的父节点或更高层级的父节点。公共祖先是指同时为节点p和q的祖先的节点。最近公共祖先&#xff08;LCA&#xff09;则是指在所有公共祖先中&#xff0c;距离p和q最近的那个节点。寻找LCA的方法可以按以下情况进行分析&#xff1a; 当…