rsync Sync Fault Handling script

Source: Internet
Author: User
Tags rsync

rsync sync failure (win08--->ubuntu12.04)

Source data server for windows2008, install Cwrsyncserver, regular sync process card die do not quit, the script to solve this problem

#!/bin/bash

Pri=/root/rsync.pwd

Ist=/root/ign.list

Sf=root@223.*.*.*::test

Dt=/var/www

Log=/var/log/cdhome_rsync.log

Pid=/tmp/cdhome_rsync.pid

Fi=/tmp/cdh_test

date= "Date +%y-%m-%d~%k:%m:%s"

sync= "/usr/bin/rsync-vuzrtogp--bwlimit=512--port=8073"

[!-F "$FI"] &&/usr/bin/touch $FI

Cdh_sync () {

echo $$ > $PID

$SYNC--exclude-from= $IST--password-file= $PRI $SF $DT

echo "' $DATE ' sync OK" >> $LOG

RM-RF $PID

Exit 0

}

if [!-F "$PID"]; then

echo $$ > $PID

Cdh_sync

Fi

Tid= ' Cat $PID '

Lid= ' PS aux|grep $TID |grep-v grep '

[-Z "$LID"] && Cdh_sync

Zid= ' Cat $FI '

if [[-N ' $LID ' &&-n ' $ZID ']];then

Kill-9 $TID

/usr/bin/killall rsync &>/dev/null

Ard= (' ps-c Rsync|awk ' {print} ' |grep-v PID ')

For d in ${ard[@]};d o

[Z $d] && continue

If PS aux|grep $d |grep-v grep; then

Kill-9 $d

Fi

Done

echo $$ > $PID

RM-RF $FI

Cdh_sync

Fi

[-N ' $LID] && echo 1 > $FI && echo ' $DATE '--> Warning!!! <--">> $LOG && exit 0

This article from the "Self-Improvement" blog, please be sure to retain this source http://mos1989.blog.51cto.com/4226977/1302195

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/zs/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.