Web Hosting Talk







View Full Version : Identical cron jobs set at the same time - Will duplicates run?


grabmail
10-25-2006, 12:53 PM
Let's say you have set 2 cron jobs that lynx a php script that backup your db every 1 hour.

Both cron jobs are the same. Same execution command. Same timing (once every hour).

In this case, will there really be 2 lynx instances hitting the php script every hour?

OR

will the duplicates be ignored and only 1 lynx instance hit the php script every hour?

cornerhost
10-25-2006, 01:14 PM
Why don't you just test it? Set it to run every minute, and see what happens. :)

But my money's on 2 instances.

<<Signature to be setup in your profile>>

grabmail
10-25-2006, 03:40 PM
i did. but how do i know how many instances were run? where do i check?

cornerhost
10-25-2006, 04:05 PM
Hmm. You could check your site's log files, since you're requesting a php script through lynx.

You could also just set up two simple jobs like this:

* * * * * date
* * * * * date

And in about 1 minute you'll get either one or two emails.

But I really don't see any reason why it would go out of its way to strip the duplicate jobs. (On my server, I got 2 emails with the same timestamp.)

<<Signature to be setup in your profile>>

Hesham A.Megid
10-25-2006, 04:11 PM
Check the place where your PHP script backups the database.

Most probably there will be 2 instances.

thunder-ltu
10-26-2006, 11:39 AM
If your host uses DirectAdmin or cPanel and put 2 cron jobs, put some output in this php script. Cron tab gathers it and sends to a default your account mailbox like your-acc-username@default-account-domain-name.com. So you can check if there were executed 2 or 1 instance of script, but I bet it will be 2 also :).

Bye