Wednesday, September 9, 2009

Prevent your script from running when create/enable cron jobs

UPDATED on Jan 24, 2010: Now SetCronJob will execute your script and check for problem only when create / enable failed cron jobs.

Every time you create / enable your cron job, your script will be executed. If you don't want this, follow this tip:

1. Move your script to other (temporary) location.

2. Create an empty file with script's name in its directory, e.g cron.php.

3. Create/Enable your cron job.

4. Delete empty file, and move your script to its original location.

This can be applied with all scripts.

If your script is written in PHP, add this


at beginning of your PHP script.

Other server-side programming languages may have its exit function. Check its documentation.

No comments:

Post a Comment