Cron job Testing

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
Abhishek
Forum Newbie
Posts: 2
Joined: Fri Aug 10, 2007 8:49 am

Cron job Testing

Post by Abhishek »

Hi,

I have this script which processes customers orders everyday. The script is supposed to run everyday and process orders for customers whose date is same as current date (e.g 10 Aug). And then it also calculates the next date (e.g 10 Sep) and saves in the db. Also other db related manipulations are done.

On the next date (i.e 10 Sep), it again will process for same customers.
Now my client wants a real time testing scenario where I do not need to go to the db to manipulate date and run the cron script. He wants to modify the system date rather and want the cron script to run as normal. Is that possible.

Please give me some thoughts.

Abhishek
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

man crontab shows:
crond automatically detects changes in the time. Reverse-indexed time changes less then an hour old will NOT re-run crontab commands
already issued in the recovered period. Forward-indexed changes less then an hour into the future will issue missed commands exactly
once. Changes greater then an hour into the past or future cause crond to resynchronize and not issue missed commands. No attempt
will be made to issue commands lost due to a reboot, and commands are not reissued if the previously issued command is still running.
For example, if you have a crontab command 'sleep 70' that you wish to run once a minute, cron will only be able to issue the command
once every two minutes. If you do not like this feature, you can run your commands in the background with an '&'.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply