Wednesday, August 30, 2017

Check which file rsync is accessing

Check current file rsync is accessing


It is quiet troublesome to find which folder or file rsync is currently scanning. Sometimes it is required check it when it is running for a long time and you are not able to find the directory where it is consuming more time.

There are several approach to find this.
1. lsof command to find the current file it is accessing.
2. Doing the rsync in vervose mode and printing it to a file

I prefer the first one as it is easier to do.

$ lsof -ad3-999 -c rsync
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME
rsync   15070 root    3r   DIR               0,20 20235264   2829984 /app/testing/documents (loaclhost:/root_vdm_1/app)
rsync   15070 root    4u  unix 0xffff880c260033c0      0t0 827481535 socket
rsync   15070 root    5u  unix 0xffff88074fb9f080      0t0 827481536 socket
rsync   15071 root    3u  unix 0xffff880b011e9480      0t0 827481546 socket
rsync   15072 root    4u  unix 0xffff880b011e9100      0t0 827481547 socket

If you want to watch it periodically(every 5 sec), then use the watch command to do it.

$ watch -n 5 "lsof -ad3-999 -c rsync"

No comments:

Post a Comment

Command to do active duplicate for Oracle Database

1. First login to target server 2. Validate tns connectivity between Source DB and Target DB 3. Prepare and validate space availability 4. S...