Sponsored Content
Operating Systems Linux Modifying Rsync script to check source Post 302563164 by treds on Monday 10th of October 2011 08:21:28 AM
Old 10-10-2011
Modifying Rsync script to check source

Hi
I am running rsyncs between a raid attached server and a nas device, which works fine.
I am using the --delete to ensure that its kept in sync. And running a log at the end of the sync for me to check. this i am running from a cron
Problem is if the part of the raid fails on the server the sync still happens resulting the data being wiped on the nas. Is there a way of writing a script that checks that the source data is valid and available before allowing the sync to run.

Code:
rsync -aWv  --stats progress  --delete --ignore-errors --exclude ".DS_Store"  --exclude ".HSancillary"  -- \
exclude ".HSxmap" --exclude ".HSResource"  /Raid/  /mnt/chi-dr/RAID/  \
 >> /mnt/chi-dr/Rsync_Logs/Chi-Raid_rsync.`date +%w`.log 2>&1


Regards
Treds

Moderator's Comments:
Mod Comment It's enough to use [CODE] tags for command lines, not for whole posts. And split the command lines if they become too long.

Last edited by jim mcnamara; 10-10-2011 at 12:12 PM.. Reason: trunc long line
 

10 More Discussions You Might Find Interesting

1. Linux

Modifying/Rebuilding non-source PRM?

I can't find a source rpm for a particular tool that I'm trying to modify. I can only get a hold of the noarch and tar.bz2. Can I modify either one of these and re-package them as a noarch.rpm? (2 Replies)
Discussion started by: eur0dad
2 Replies

2. Shell Programming and Scripting

Rsync help - unable to delete the Source file

Hi All, I am facing problem deleting Source while using the rsync command. rsync --include=*`date --date="-1 day" \+\%Y\%m\%d`* --include=*`date +\%Y\%m\%d`* --exclude=* --delete-after -auvb -e ssh USER@SERVER:SOURCE DESTINATION However the sync happens but not the deletion of the source... (1 Reply)
Discussion started by: amitkhiare
1 Replies

3. UNIX for Advanced & Expert Users

Why rsync deletes source directory?

Hi I have a strange problem. Sometimes when I execute the below command something wierd happens. rsync -avz -e ssh travegre@travegre.net: ../travegre.net/ the folder named "hm" that is held in travegre.net and is coppied along with all the other folders and data at travegre.net, gets... (1 Reply)
Discussion started by: travegre
1 Replies

4. Shell Programming and Scripting

rsync - update file on backup when file renamed on source

hi all, Please help me with rsync. I configured rsync to preserve timestamps using the -a option. When i renamed fileA to fileB on source machine I have to copies at the backup server. The aim is to keep the most recent file. fileA & fileB has same contents. When i renamed fileB to... (2 Replies)
Discussion started by: coolatt
2 Replies

5. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

6. Shell Programming and Scripting

Need some help modifying script

I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets. my current script starts like this: errLog="/usr/local/website-logs/error.log" apacheRestart="service httpd restart"... (3 Replies)
Discussion started by: jjj0923
3 Replies

7. UNIX for Advanced & Expert Users

Rsync error while running from destination to source

hi All, i have 2 server setup now for Rsync, i configured Rsync on both of the server and it worked well when i did run from source to destination. and while running back from destination to source it produced this error: bash-3.2$ ksh rsync_bravo_db.ksh usa0300uz1247.apps.mc.xerox.com... (0 Replies)
Discussion started by: lovelysethii
0 Replies

8. UNIX for Dummies Questions & Answers

Does rsync check and ignore files that already exist?

Hi, We have two (2) servers named primary and standby. There is a directory named /db01/archive that we need to keep in-sync. Files get transferred from primary and standby. Sometimes when we do a failover or when there is a network issue, some files fail to get transferred. I want to use... (3 Replies)
Discussion started by: newbie_01
3 Replies

9. Shell Programming and Scripting

Rsync files check

Hello everybody, I sent some files a remote server using simple ssh command line: rsync -e 'ssh -p SSH-PORT' -vr --log-file=/var/log/rsync.log /home/USER/www/* USER@IP:/home/USER/www Then I would like to check if files in server1 are the same, file size check or any other way to make... (4 Replies)
Discussion started by: Abu Rayane
4 Replies

10. UNIX for Beginners Questions & Answers

Move directory with rsync and delete from source

I need a rsync command which will exclude certain files and directories from source and copy the rest. I got this command working, sudo rsync -avzh --exclude 'bin' --exclude 'braintree' --exclude 'colinmollenhour' --exclude 'composer' --exclude 'doctrine' --exclude 'fabpot' --exclude... (2 Replies)
Discussion started by: Siddheshk
2 Replies
SYNC(8) 						    BSD System Manager's Manual 						   SYNC(8)

NAME
sync -- force completion of pending disk writes (flush cache) SYNOPSIS
sync DESCRIPTION
The sync utility can be called to ensure that all disk writes have been completed before the processor is halted in a way not suitably done by reboot(8) or halt(8). Generally, it is preferable to use reboot(8) or halt(8) to shut down the system, as they may perform additional actions such as resynchronizing the hardware clock and flushing internal caches before performing a final sync. The sync utility utilizes the sync(2) function call. SEE ALSO
fsync(2), sync(2), syncer(4), halt(8), reboot(8) HISTORY
A sync utility appeared in Version 4 AT&T UNIX. BSD
May 31, 1993 BSD
All times are GMT -4. The time now is 04:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy