inotifywait ferramenta mostra vários logs para o mesmo tempo ao substituir binário

0

Sempre que eu substituir um arquivo binário no diretório que é adicionado em intoifywait list.I estou recebendo mesmo log várias vezes.Mas para outros arquivos como .js etc. Ele está funcionando bem. Abaixo estão os registros

monitor_status DELETE 2018-08-12 14:07:54
monitor_status CREATE 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
monitor_status MODIFY 2018-08-12 14:07:54
hello CREATE 2018-08-12 14:09:38
monitor_status DELETE 2018-08-14 07:02:52
monitor_status CREATE 2018-08-14 07:02:52
monitor_status MODIFY 2018-08-14 07:02:52
monitor_status MODIFY 2018-08-14 07:02:52
monitor_status MODIFY 2018-08-14 07:02:52
monitor_status MODIFY 2018-08-14 07:02:52
monitor_status MODIFY 2018-08-14 07:02:52
    
por user305373 14.08.2018 / 10:33

1 resposta

0

inotifywait mostra todo syscal de 'gravação'. No caso de cp simples (na minha máquina de teste e ext4), ele faz operações de modificação para cada 64k:

# dd if=/dev/urandom of=test bs=64K count=1
1+0 records in
1+0 records out
65536 bytes (66 kB) copied, 0.00178826 s, 36.6 MB/s
# cp test test2

dá (copiando apenas):

./ OPEN test
./ MODIFY test2
./ OPEN test2
./ ACCESS test
./ MODIFY test2
./ CLOSE_WRITE,CLOSE test2
./ CLOSE_NOWRITE,CLOSE test

Mas:

# dd if=/dev/urandom of=test bs=128K count=1
1+0 records in
1+0 records out
131072 bytes (131 kB) copied, 0.00251142 s, 52.2 MB/s
# cp test test2

dá (copiando apenas):

./ OPEN test
./ MODIFY test2
./ OPEN test2
./ ACCESS test
./ MODIFY test2
./ ACCESS test # one more time
./ MODIFY test2 # one more time
./ CLOSE_WRITE,CLOSE test2
./ CLOSE_NOWRITE,CLOSE test

A mesma coisa mostrada na strace:

# 64k file
open("test", O_RDONLY)                  = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=65536, ...}) = 0
open("test2", O_WRONLY|O_TRUNC)         = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, "47334A1R13\f26K\n0\f0x}/6}a1735"..., 65536) = 65536
write(4, "47334A1R13\f26K\n0\f0x}/6}a1735"..., 65536) = 65536
read(3, "", 65536)                      = 0
close(4)                                = 0
close(3)                                = 0

# 128k file
open("test", O_RDONLY)                  = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=131072, ...}) = 0
open("test2", O_WRONLY|O_TRUNC)         = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, "pK;66gx704:3r
# dd if=/dev/urandom of=test bs=64K count=1
1+0 records in
1+0 records out
65536 bytes (66 kB) copied, 0.00178826 s, 36.6 MB/s
# cp test test2
55b\r?261q54"..., 65536) = 65536 write(4, "pK;66gx704:3r
./ OPEN test
./ MODIFY test2
./ OPEN test2
./ ACCESS test
./ MODIFY test2
./ CLOSE_WRITE,CLOSE test2
./ CLOSE_NOWRITE,CLOSE test
55b\r?261q54"..., 65536) = 65536 read(3, "515X50xL\nhW\"05P]67#152:f9q35\n"..., 65536) = 65536 write(4, "515X50xL\nhW\"05P]67#152:f9q35\n"..., 65536) = 65536 read(3, "", 65536) = 0 close(4) = 0

Não sei se depende do sistema de arquivos ou o quê, mas o cp copia arquivos em partes de tamanho fixo (no meu caso 64k), e quando cada parte é escrita você pode ver o evento 'modify'.

    
por 14.08.2018 / 16:56

Tags