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

* 9 * * * [ ! -f /tmp/lockFile ] && { touch /tmp/lockRsync ; rsync whatever; rm /tmp/lockRsync }

Thanks,

But i know how to get around.

Was just curious how the crons will behave.

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? :slight_smile:

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.

Rsync ...

Cron is just a way to start and it can be forgot now.