1

I need to have a central countdown timer for my website which will be common for all users.

This countdown timer will be reloaded after cycle of 7days. Which means,the database will have a collection that stores- StartDate: ,StartTime: ,EndDate: , EndTime:

And when the endtime is reached one cycle ends and the next cycle of 7days begins for which the same fields are updated. How to trigger command from shell and not from the php code. Also, is it possible to manipulate it using php?

Aishwarya R
  • 647
  • 2
  • 12
  • 25

1 Answers1

0

There is no thing such as a SQL trigger in MongoDB. Although there are some tricks for creating triggers. See the following question and answer explaining how to create one:

How to listen for changes to a MongoDB collection?

However the correct way to do this is creating a cron job. A cron job is a script that is run in Unix and can be triggered periodically (e.g. every Friday night). You can find more info about cron in the following link explaining what a cron job is:

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

And if you want to create one, follow the following guide:

http://www.thesitewizard.com/general/set-cron-job.shtml

Community
  • 1
  • 1
Felipe Sulser
  • 1,185
  • 8
  • 19