Rsync via cron


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Rsync via cron
# 1  
Old 07-03-2007
Rsync via cron

Hi,

I am running a rsync via cron job.

Its running fine and is scheduled to 9:00 AM everyday.

Sometimes it runs for more than 24 hours, such that the next days cron also fires.

Now how will the sync happen as the <sync file> that both crons have created might conflict.

Thanks
# 2  
Old 07-03-2007
Code:
* 9 * * * [ ! -f /tmp/lockFile ] && { touch /tmp/lockRsync ; rsync whatever; rm /tmp/lockRsync }

# 3  
Old 07-03-2007
Thanks,

But i know how to get around.

Was just curious how the crons will behave.
# 4  
Old 07-03-2007
Means rsync is going to copy one file, but sees that's already there.

What will it do now, overwrite or leave it and why? Smilie
# 5  
Old 07-03-2007
Are you asking about rsync's behaviour or cron's? The cronjob is written to first check if a lock file is present and if not, create the lock and run the job. It then removes the lock file before exiting. I have never used rsync, but I believe you can specify how rsync should behave under the conditions that you have specified.
# 6  
Old 07-03-2007
Rsync ...

Cron is just a way to start and it can be forgot now.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Email Notifications on Cron Bash Error Only cp mv rsync

Wondering if anyone can point me to an example of how to setup a bash script that executes cp mv and rsync commands and only sends an email if there were errors with any of those commands and what the errors are. In addition it should email if the cron event to execute the script fails, or in... (1 Reply)
Discussion started by: consultant
1 Replies

3. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

4. UNIX and Linux Applications

Rsync works in shell but not in cron

So I have this rsync script I wrote to grab some sql files and import them to a database. I left in the mysql stuff just give context to the situation. The real problem is with my rsync code. script.sh (chmod 744) #!/bin/sh rsync -av --rsh="sshpass -p'PASSWORD' ssh -l'USERNAME'"... (3 Replies)
Discussion started by: noPermissions
3 Replies

5. UNIX for Dummies Questions & Answers

Problems using rsync with cron

Hi, I've created a cron job for a script with a rsync command in it. The script is named pull.sh and contains the following line : What it is supposed to do is pull backup files from the production server of my company to my local server. It should also generate the log file (output.log)... (1 Reply)
Discussion started by: anaigini45
1 Replies

6. UNIX for Advanced & Expert Users

rsync not working thro' cron

Hi, I am able to use rsync and run it thro' command line. But when I schedule a script file that has rsync command thro' cron, the job doesn't get executed. All other jobs in the cron runs fine. cron entry-- 57 13 * * * /home/apm/cron/rsync-backup.sh rsync-backup.sh file-- rsync -avz... (1 Reply)
Discussion started by: sm23328
1 Replies

7. UNIX for Dummies Questions & Answers

rsync not working thro' cron -RH Linux

Hi, I am able to use rsync and run it thro' command line. But when I schedule a script file that has rsync command thro' cron, the job doesn't get executed. All other jobs in the cron runs fine. cron entry-- 57 13 * * * /home/apm/cron/rsync-backup.sh rsync-backup.sh file-- rsync -avz... (1 Reply)
Discussion started by: sm23328
1 Replies

8. Shell Programming and Scripting

Rsync script in cron from stepping on itself

I have the following rsync script that I use for syncing MySQL files from one server to another. I run the script at 20 minutes past every second hour in cron. I want to make sure that the script completes in it's entirety before it is set to kick off again. For example, when the script starts at... (3 Replies)
Discussion started by: sunsysadm2003
3 Replies

9. AIX

AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log

Hi, I can use 'crontabs –e' and do all the scheduling I like. However I would like to auto send myself just the cronjobs logs that fail. That is to say the PIDs that fail and the related lines with those PID’s only. (Not the full set of logs) Has anyone done this work? Or does an AIX 5.3 tool... (0 Replies)
Discussion started by: Keith Johnson
0 Replies

10. UNIX for Dummies Questions & Answers

use rsync by cron

Hi there: I run rsync very well by typing: rsync -avz /source /destination Then I want to run it by cron. So I had a crontab file like this: * * * * * rm file * * * * * rsync -avz /source /destination > cron_result (The first line is used to test whether cron is working.) When I check... (0 Replies)
Discussion started by: Steven.surfboy
0 Replies
Login or Register to Ask a Question