Strange problem with rsync and expect
Guangmu Zhu
guangmuzhu at gmail.com
Tue Jun 16 00:38:53 MDT 2015
Version: 3.0.6OS: CentOS 6.6
I met a strange problem when using rsync with expect. I wrote a script backing up using rsync and expect. However when I run the script twice for two different files at same time, the two files on destination path would be deleted automatically before the files closed. The output of inotify_wait was like:
./ MODIFY .redo02.log.dOlbek
./ DELETE .redo02.log.dOlbek
./ CLOSE_WRITE,CLOSE .redo02.log.dOlbek
I didn't use any --del options and tried --ignore-errors --max-delete=0, but they didn't work. The problem happened only when two processes were running at same time. Here is my script:#!/usr/bin/expect
log_user 0
set env(LANG) en_US.UTF-8
set user "[lindex $argv 0]"
set bwlimit "[lindex $argv 1]"
set timeout "[lindex $argv 2]"
set src_path "[lindex $argv 3]"
set dest_ip "[lindex $argv 4]"
set dest_path "[lindex $argv 5]"
set passwd "[lindex $argv 6]"
spawn rsync -artqz4 -e "ssh -p 22 -o StrictHostKeyChecking=no -l $user" \
--bwlimit=$bwlimit --timeout=$timeout "$src_path" "$dest_ip:$dest_path"
expect {
"Connection refused" {exit 1}
"Name or service not known" {exit 2}
"Permission denied*" {exit 3}
"continue connecting" {send "yes\r"; exp_continue}
"password:" {send "$passwd\r"; exp_continue}
}
exit
May I did something wrong? Thanks in advance.
Guangmu Zhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20150616/a5b722e3/attachment.html>
More information about the rsync
mailing list