I'm currently building an app that includes sales promotions. There is an option in the promotion that allows the manager to have a start and end date. I do not want the manager to have to manually select the winner, but I want my software to read that the end date was reached and auto close the promotion.

This sounds like a job for cron.

These are my options:

  1. At night, run a single script that pulls all promotions across my entire database and updates promotions that have completed.
  2. At the creation of the promotion record, queue up a cron to run at the custom end date.
  3. Force the user to manually update promotion.

Any advice or previous experience would be greatly appreciated!

  • What criteria will you use to choose the best option? Commented Feb 7, 2018 at 1:33
  • Related, if not a duplicate: softwareengineering.stackexchange.com/q/334673/20756
    – Blrfl
    Commented Feb 7, 2018 at 2:15
  • @RobertHarvey What do you mean?
    – Phil
    Commented Feb 7, 2018 at 17:38
  • How will you choose which option to use? Some options will be better for you than others. What does "better" mean to you? Commented Feb 7, 2018 at 18:14

1 Answer 1


In my experience you want to make sure your application fulfills the following key tests

  • When you run it, it searches for everything that needs doing and does it.

  • If you run two or more instances at the same time. nothing breaks and the work gets done as normal.

  • If it crashes half way through, nothing bad happens and you can just run it again.

  • You have some way of excluding things from its search. So you can tell it to ignore promotion X for example.

  • You have a way to set a manual approval/publish step before the results are sent out to live customers. You can turn this off once you are sure of the process, but to begin with it is vital.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.