-1

I'm developing a kind of program like this http://support.microsoft.com/kb/308569

Let's say "Task A" (1 and only 1 task) is to be performed on either of following schedules.

Daily
Weekly
Monthly
When Application Starts

The settings is going to be stored in a DB table.

question is how to implement and track if the task as per schedule was run. Please also suggest how the DB structure should be.

Do I've to keep checking every specific interval if I need to run this task or how this works.

Theoretical help/algorithm required for the db structure and program and will implement accordingly.

Development Environment is JavaScript with WebSQL as a database or PHP with MySQL

user2727195
  • 7,122
  • 17
  • 70
  • 118
  • I am afraid your question is too broad. You are practically asking the community to design the program for you. – sampathsris Jul 16 '14 at 17:32
  • you're right @Krumia, it sounds like but I just need guidance, especially for the database, should I just have a table with a column that says daily, weekly, monthly, start and then trigger the task on launch, that makes me ask question what if the task is already run? wish if someone can describe this theoretically – user2727195 Jul 16 '14 at 18:22

1 Answers1

0

have DB structure like this.

schedule
-id
-type (daily, weekly, monthly)
-lastRun (timestamp)

update the schedule table with the timestamp of the task you run and setInterval again for the next iteration based on the type and then update timestamp after the next run.

on application launch find the difference between current timestamp and lastRun timestamp and if it's more than the type (daily, weekly, monthly), run the task.