bostboy — 2011-03-05T10:29:59-05:00 — #1
I searched on this and didn't run into anything so if someone could point me in the right direction I would appreciate it.
I want to run an update every night just after midnight (server time) to update the status of records in a table that are expired based on an expired date carried in the table. I can write the syntax of the query just fine but I don't know how to make it fire on a schedule.
r937 — 2011-03-05T11:55:39-05:00 — #2
maybe it's me, but this seems like overkill
bostboy — 2011-03-05T12:11:52-05:00 — #3
Maybe so. I have 4 types of active statuses and two types of expired statuses, so it's a little more than just the expired date. In other words, I'm not just setting the status to active if it's before the date and expired if it's after the date. It will be set to one if there is certain activity and another if there is not.
I suppose I could do that logic every time I use this info but it seems a lot easier to do it once and then when I am processing the data later it is much easier. For example, when I retrieve the data, I want to sort it by the different statuses. If I have to do that logic, it seems much more complex to me, if it is even possible.
spacephoenix — 2011-03-05T13:49:57-05:00 — #4
For running scripts on a schedule in Linux you have cron jobs and in windows you have task scheduler
bostboy — 2011-03-05T17:54:50-05:00 — #5
lemon_juice — 2011-03-05T17:56:18-05:00 — #6
I haven't used them yet but mysql events introduced in mysql 5.1 should be just want you are looking for.
bostboy — 2011-03-05T18:22:17-05:00 — #7
That looks like what I am looking for. I will read up on it and give it a try. They do mention that it is similar to cron jobs and task scheduler which was previously mentioned. Does anyone have any practical experience as to which is better assuming one is.