interval in a launchd script

Hi,

i'm planning a to automate my backup with a rsync user deamon in my launchd and let that run every 2 hours.
my server contains a lot of video data which can expand rapidly , up to 1TB, in an interval of 2 hours.
now i'm wondering what will happen when a rsync is running longer then the interval and the next command is already given. will it abort one of them? place them in a cue? or will it start running anyway? in the last case i can imagine that this will cause incomplete/corrupt files on my backup filesystem.
does anyone know the answer to this?

thanks in advance,

wessel

Doesn't look like you're getting much response here.

I understand that launchd is intended to replace cron, among other things. And I haven't really looked at that aspect of launchd. I have created stuff that runs at startup with it.

What you are talking about has two components. One is the basic running things every 2 hours. If you've got that, then ok. I'd be inclined to just toss it in cron, because that still works.

The other aspect is how to deal with the previous instance still being running. If you create your own shell script, instead of directly running rsync, then you can do a couple of different things. One of the more common approaches is to implement a pid file. When the script runs, it checks to see if the pid file exists. If it does, the script terminates, with maybe a log or error message. If it doesn't it creates it. Then when it is done, it removes it.

So, something like

echo $$ > /var/run/runrsync.pid

would put the process id of the current script into that location.

Anyway, after the book keeping, the script would launch rsync.

Part of the reason I didn't respond sooner was that I don't know what facilities launchd has built in for managing this sort of thing. I could be giving you an outdated solution to something that launchd has solved more elegantly.